[Django] #29067: QuerySet.values_list(..., flat=True) combined with .annotate() incorrectly includes the annotate columns

7 views
Skip to first unread message

Django

unread,
Jan 25, 2018, 11:50:00 PM1/25/18
to django-...@googlegroups.com
#29067: QuerySet.values_list(..., flat=True) combined with .annotate() incorrectly
includes the annotate columns
-------------------------------------+-------------------------------------
Reporter: Jon | Owner: nobody
Dufresne |
Type: Bug | Status: new
Component: Database | Version: 2.0
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 |
-------------------------------------+-------------------------------------
Regression introduced in Django 2.0.

In `FlatValuesListIterable.__iter__()`, can't assume the returned rows
have a single column as using `.annotate()` may have added additional
columns to the `SELECT`.

Introduction bisected to commit 4dfd6b88d520b43b6363946e5ee58ba14cd1efe6.

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

Django

unread,
Jan 26, 2018, 12:00:58 AM1/26/18
to django-...@googlegroups.com
#29067: QuerySet.values_list(..., flat=True) combined with .annotate() incorrectly
includes the annotate columns
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 2.0
(models, ORM) |
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 Jon Dufresne):

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/9623

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

Django

unread,
Jan 26, 2018, 4:32:48 AM1/26/18
to django-...@googlegroups.com
#29067: QuerySet.values_list(..., flat=True) combined with .annotate() incorrectly
includes the annotate columns
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Bug | Status: new

Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* stage: Unreviewed => Ready for checkin


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

Django

unread,
Jan 26, 2018, 6:15:31 AM1/26/18
to django-...@googlegroups.com
#29067: QuerySet.values_list(..., flat=True) combined with .annotate() incorrectly
includes the annotate columns
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Bug | Status: new

Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Release blocker | Resolution:

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* severity: Normal => Release blocker


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

Django

unread,
Jan 26, 2018, 10:14:30 AM1/26/18
to django-...@googlegroups.com
#29067: QuerySet.values_list(..., flat=True) combined with .annotate() incorrectly
includes the annotate columns
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
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:"3187c89d6f8c60ca7e78093d5b37e0709e71cea9" 3187c89]:
{{{
#!CommitTicketReference repository=""
revision="3187c89d6f8c60ca7e78093d5b37e0709e71cea9"
Fixed #29067 -- Fixed regression in QuerySet.values_list(..., flat=True)
followed by annotate().
}}}

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

Django

unread,
Jan 26, 2018, 10:30:49 AM1/26/18
to django-...@googlegroups.com
#29067: QuerySet.values_list(..., flat=True) combined with .annotate() incorrectly
includes the annotate columns
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
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:"61c74ae74f6e23e5c6468c1bc2adb348c60cc289" 61c74ae]:
{{{
#!CommitTicketReference repository=""
revision="61c74ae74f6e23e5c6468c1bc2adb348c60cc289"
[2.0.x] Fixed #29067 -- Fixed regression in QuerySet.values_list(...,
flat=True) followed by annotate().

Regression in 4dfd6b88d520b43b6363946e5ee58ba14cd1efe6.

Backport of 3187c89d6f8c60ca7e78093d5b37e0709e71cea9 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29067#comment:5>

Reply all
Reply to author
Forward
0 new messages