#24692: QuerySet.extra(select=...) is silently dropped with aggregations -------------------------------------+------------------------------------- Reporter: jdelic | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Database layer | Version: 1.8 (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 -------------------------------------+-------------------------------------
Comment (by shaib): So, I see two separate issues here. The first is that `period` was not selected in the original query. That, I think, is exactly expected behavior -- that's what `values()` does. The second is that, as demonstrated by adding `"period"` to the `values()` call, `extra()` does not support aggregates well (the error is caused by the ORM assuming that `period` is a non-aggregate field, and so must be pulled into the group-by clause for the aggregate to work). This, AFAICT, cannot be solved without adding to `extra()` an argument (or a sub- argument) to specify which of the `select` keys are aggregates; and that, combined with Tim's comments above, makes me think this should be wontfix'd. -- Ticket URL: <https://code.djangoproject.com/ticket/24692#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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.4103044b1cf011f6fdab8a320c50374d%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.