[Django] #24924: Incorrect Join Promotion with Annotations

11 views
Skip to first unread message

Django

unread,
Jun 4, 2015, 12:01:48 PM6/4/15
to django-...@googlegroups.com
#24924: Incorrect Join Promotion with Annotations
-------------------------------+--------------------
Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
This was originally addressed in #24766 and released in 1.8.2 but as noted
here https://code.djangoproject.com/ticket/24766#comment:7 this problem
still exists if there are multiple annotations. Working on a failing test
case.

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

Django

unread,
Jun 4, 2015, 1:17:44 PM6/4/15
to django-...@googlegroups.com
#24924: Incorrect Join Promotion with Annotations
---------------------------+----------------------------

Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------+----------------------------
Changes (by robline):

* Attachment "24924.diff" added.

Failing test case

Django

unread,
Jun 4, 2015, 1:21:32 PM6/4/15
to django-...@googlegroups.com
#24924: Incorrect Join Promotion with Annotations
-------------------------------+--------------------------------------

Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
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
-------------------------------+--------------------------------------
Changes (by robline):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Attached a test case that fails because of this issue.
{{{

$ python runtests.py expressions_case
Creating test database for alias 'default'...
Creating test database for alias 'other'...
......................................F.....................s...............
======================================================================
FAIL: test_join_promotion_with_multiple_annotations
(expressions_case.tests.CaseExpressionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rob/rob/caktus/django/tests/expressions_case/tests.py", line
1073, in test_join_promotion_with_multiple_annotations
lambda x: (x, x.foo, x.bar)
File "/home/rob/rob/caktus/django/django/test/testcases.py", line 932,
in assertQuerysetEqual
return self.assertEqual(list(items), values, msg=msg)
AssertionError: Lists differ: [] != [(<CaseTestModel: 1, 1>, 3, 5)]

Second list contains 1 additional elements.
First extra element 0:
(<CaseTestModel: 1, 1>, 3, 5)

- []
+ [(<CaseTestModel: 1, 1>, 3, 5)]

----------------------------------------------------------------------
Ran 76 tests in 0.172s

FAILED (failures=1, skipped=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
}}}

The query returns an empty list because of the inner join.

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

Django

unread,
Jun 5, 2015, 11:01:35 AM6/5/15
to django-...@googlegroups.com
#24924: Incorrect Join Promotion with Annotations
-------------------------------+--------------------------------------

Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by mlavin):

* has_patch: 0 => 1


Comment:

Added PR to fix https://github.com/django/django/pull/4810. Docs added
under the assumption that this bug would be backported to 1.8.X.

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

Django

unread,
Jun 5, 2015, 12:23:15 PM6/5/15
to django-...@googlegroups.com
#24924: Incorrect Join Promotion with Annotations
-------------------------------+--------------------------------------
Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"541f4ea546ad3065852db816769ba6b584e3f373" 541f4ea5]:
{{{
#!CommitTicketReference repository=""
revision="541f4ea546ad3065852db816769ba6b584e3f373"
Fixed #24924 -- Join promotion for multiple Case expressions
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24924#comment:3>

Django

unread,
Jun 5, 2015, 12:23:27 PM6/5/15
to django-...@googlegroups.com
#24924: Incorrect Join Promotion with Annotations
-------------------------------+--------------------------------------
Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"0cfb7ed5c531d3fdb1c4eb79a004c2ea7e7a23e3" 0cfb7ed]:
{{{
#!CommitTicketReference repository=""
revision="0cfb7ed5c531d3fdb1c4eb79a004c2ea7e7a23e3"
[1.8.x] Fixed #24924 -- Join promotion for multiple Case expressions

Backport of 541f4ea546ad3065852db816769ba6b584e3f373 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24924#comment:4>

Reply all
Reply to author
Forward
0 new messages