Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#10256 closed (fixed)

values() and values_list() either include all or no columns from the extra(select=) clause

Reported by: Russell Keith-Magee Owned by: Russell Keith-Magee
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

By way of example, this is what 1.0.X produces:

>>> Book.objects.extra(select={'a':'name','b':'price','c':'pages'}).values('name','pages','a')
[{'a': u'Book 1', 'c': 11, 'b': Decimal("11.11"), 'name': u'Book 1', 'pages': 11}, ...

>>> Book.objects.extra(select={'a':'name','b':'price','c':'pages'}).values('name','pages')
[{'name': u'Book 1', 'pages': 11}, ...

That is, if you don't explicitly mention an extra selected column in the values() clause, they are omitted (as expected). However, as soon as you include a single extra column, _all_ extra columns are included in the returned values.

Analogous behavior exists for values_list().

Change History (3)

comment:1 by Russell Keith-Magee, 16 years ago

Owner: changed from nobody to Russell Keith-Magee
Triage Stage: UnreviewedAccepted

I'm working on this - I should commit a fix shortly.

comment:2 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(In [9837]) Fixed #10256 -- Corrected the interaction of extra(select=) with values() and values_list() where an explicit list of columns is requested.

comment:3 by Russell Keith-Magee, 16 years ago

(In [9884]) [1.0.X] Fixed #10256 -- Corrected the interaction of extra(select=) with values() and values_list() where an explicit list of columns is requested.

Merge of r9837 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top