#31880: QuerySet.aggregate() mixes annotated fields names. -------------------------------------+------------------------------------- Reporter: Thodoris | Owner: nobody Sotiropoulos | Type: Bug | Status: new Component: Database layer | Version: 3.1 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by felixxm):
* type: Uncategorized => Bug * stage: Unreviewed => Accepted Comment: > I would expect django to generate > > {{{#!sql > SELECT MAX(`anon`), SUM(`anon`) FROM (SELECT `table`.`foo` AS `anon` FROM `table`) subquery > }}} I would rather expect: {{{#!sql SELECT MAX(`anon`), SUM(`foo`) FROM (SELECT `table`.`foo`, `table`.`foo` AS `anon` FROM `table`) subquery }}} Nevertheless we should raise a descriptive error or add a column to the `subquery`. Is there any reason to not use `Sum(F('anon'))`? -- Ticket URL: <https://code.djangoproject.com/ticket/31880#comment:1> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.9009383bbde305c149c48dd5c12ecafa%40djangoproject.com.