[Django] #30244: Aggregate functions with filter have bug with state mutation in get_source_expressions() method

1 view
Skip to first unread message

Django

unread,
Mar 8, 2019, 4:19:36 PM3/8/19
to django-...@googlegroups.com
#30244: Aggregate functions with filter have bug with state mutation in
get_source_expressions() method
-------------------------------------+-------------------------------------
Reporter: gtors | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 2.1
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/30244>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 9, 2019, 10:53:01 AM3/9/19
to django-...@googlegroups.com
#30244: Aggregate functions with filter have bug with state mutation in
get_source_expressions() method
-------------------------------------+-------------------------------------
Reporter: Andrey Torsunov | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Herman S):

Looks like this was fixed in #30011
(https://code.djangoproject.com/changeset/53269bcaaf1fc2ce4db797d7d8935d98a53494df)

--
Ticket URL: <https://code.djangoproject.com/ticket/30244#comment:1>

Django

unread,
Mar 9, 2019, 12:37:38 PM3/9/19
to django-...@googlegroups.com
#30244: Aggregate functions with filter have bug with state mutation in
get_source_expressions() method
-------------------------------------+-------------------------------------
Reporter: Andrey Torsunov | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Andrey Torsunov):

* status: new => closed
* resolution: => fixed


Comment:

This is good news, so I will wait for the Django 2.2. Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/30244#comment:2>

Reply all
Reply to author
Forward
0 new messages