#31679: Django subtly produces incorrect query when the same keyword appears in
both aggregate() and annotate()
-------------------------------------+-------------------------------------
Reporter: StefanosChaliasos | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 3.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Kristijan Mitrovic):
> {{{#!python
> Model.objects.annotate(foo=F('column')).aggregate(foo=Sum(F('foo')))
> }}}
So in the example above, where both annotated and aggregated kwargs are
named `foo`, the output should actually contain just the last one, right?
The first annotated `foo` column can just be renamed and then removed from
the final result (to avoid confusion). That would be accesptable solution
without large rewriting of the code I hope.
--
Ticket URL: <https://code.djangoproject.com/ticket/31679#comment:9>
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/075.f285c6e948a9ed47e26a50cdc6265f58%40djangoproject.com.