Opened 6 years ago
Closed 6 years ago
#30244 closed Bug (fixed)
Aggregate functions with filter have bug with state mutation in get_source_expressions() method
Reported by: | Andrey Torsunov | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.1 |
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
Django 2.1.7
In [27]: s = Sum('x', filter=Q(x=1)) In [28]: s.get_source_expressions() Out[28]: [F(x), <Q: (AND: ('x', 1))>] In [29]: s.get_source_expressions() Out[29]: [F(x), <Q: (AND: ('x', 1))>, <Q: (AND: ('x', 1))>] In [30]: s.get_source_expressions() Out[30]: [F(x), <Q: (AND: ('x', 1))>, <Q: (AND: ('x', 1))>, <Q: (AND: ('x', 1))>]
Each call of get_source_expressions
on instance of aggregate function causes list element duplication.
Change History (2)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is good news, so I will wait for the Django 2.2. Thanks!
Note:
See TracTickets
for help on using tickets.
Looks like this was fixed in #30011 (https://code.djangoproject.com/changeset/53269bcaaf1fc2ce4db797d7d8935d98a53494df)