Opened 4 months ago
Closed 4 months ago
#36361 closed Bug (needsinfo)
Grouping by date/datetime/time subfields then aggregating causes the sql compiler to explode
Reported by: | Lily A. N. | Owned by: | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 5.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
example:
Foo.objects.values('date__year','val').annotate(total=models.Sum('val'))
Note:
See TracTickets
for help on using tickets.
Unfortunately it's impossible to know for sure with the low amount of details your provided (lack of complete model definition, traceback, exact version of Django you reproduced against) but I'm pretty sure this is duplicate of #36292 (Annotating an aggregate function over a group including annotations or transforms followed by a column references crashes with
IndexError
) fixed by 543e17c4405dfdac4f18759fc78b190406d14239 in Django 5.2.1 meant to be released on May 7th.