Opened 5 years ago
Closed 5 years ago
#30572 closed Bug (fixed)
Composed queries cannot change the list of columns with values()/values_list().
Reported by: | Mariusz Felisiak | Owned by: | Mariusz Felisiak |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Composed queries cannot change the list of columns when values()/values_list()
is evaluated multiple times, e.g.
>>> ReservedName.objects.create(name='a', order=2) >>> qs1 = ReservedName.objects.all() >>> print(qs1.union(qs1).values_list('name', 'order').get()) ('a', 2) >>> print(qs1.union(qs1).values_list('order').get()) ('a', 2)
(see compiler.py#L428-L433).
Attachments (1)
Change History (6)
by , 5 years ago
Attachment: | 30572.diff added |
---|
comment:1 by , 5 years ago
Has patch: | set |
---|
comment:2 by , 5 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:4 by , 5 years ago
Resolution: | fixed |
---|---|
Status: | closed → new |
Version: | master → 2.2 |
I can confirm that I can reproduce this bug in the latest LTS version Django 2.2 as well, is there a chance for this bugfix to be backported to 2.2? The current patch should apply cleanly in stable/2.2.x.
comment:5 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Version: | 2.2 → master |
This patch doesn't qualify for a backport. Please don't reopen closed tickets.
Note:
See TracTickets
for help on using tickets.
PR