#28900: QuerySet.values() and values_list() for compound queries fails with
annotation.
-------------------------------------+-------------------------------------
Reporter: elliott-omosheye | Owner: Simon
| Charette
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: union, values | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):
In [changeset:"65ad4ade74dc9208b9d686a451cd6045df0c9c3a" 65ad4ade]:
{{{#!CommitTicketReference repository=""
revision="65ad4ade74dc9208b9d686a451cd6045df0c9c3a"
Refs #28900 -- Made SELECT respect the order specified by
values(*selected).
Previously the order was always extra_fields + model_fields + annotations
with
respective local ordering inferred from the insertion order of *selected.
This commits introduces a new `Query.selected` propery that keeps tracks
of the
global select order as specified by on values assignment. This is crucial
feature to allow the combination of queries mixing annotations and table
references.
It also allows the removal of the re-ordering shenanigans perform by
ValuesListIterable in order to re-map the tuples returned from the
database
backend to the order specified by values_list() as they'll be in the right
order at query compilation time.
Refs #28553 as the initially reported issue that was only partially fixed
for annotations by d6b6e5d0fd4e6b6d0183b4cf6e4bd4f9afc7bf67.
Thanks Mariusz Felisiak and Sarah Boyce for review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28900#comment:22>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107019079068b48-a17592eb-d37b-4d50-986e-b8c46157d92c-000000%40eu-central-1.amazonses.com.