#36352: values() raises a FieldError when multiple values() of annotated values are
chained
-------------------------------------+-------------------------------------
Reporter: Joseph Yu | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: .values, distinct | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
It looks like we could error out with a more appropriate message but we've
made some significant changes in since 4.2 to prevent obscuring existing
field references with annotations.
In other words I would expect calls of the form
`Mapping.objects.annotate(foo=F('foo__name'))` and
`Mapping.objects.annotate(foo_id=F('foo_id'))` to always be problematic to
some extent even when values is used as they turn follow up references to
such annotations ambiguous.
For example, what should
`annotate(foo=F('foo__name')).filter(foo__name="Bar")` resolve to or
surface as error?
--
Ticket URL: <
https://code.djangoproject.com/ticket/36352#comment:10>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.