[Django] #21252: Positional column numbers is not always correct for ORDER BY and GROUP BY

26 views
Skip to first unread message

Django

unread,
Oct 9, 2013, 11:50:29 AM10/9/13
to django-...@googlegroups.com
#21252: Positional column numbers is not always correct for ORDER BY and GROUP BY
----------------------------------------------+--------------------
Reporter: manfre | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
"SELECT ... GROUP BY 1 ORDER BY 1" is very fragile and may not associate
with the intended column if any columns are front loaded on to the select.
Columns are front loaded by extra() and could be added by 3rd party
database backends.

There are discussions of no longer front loading the extra() select
columns. Assuming this change happens, the problem space would be reduced
to just 3rd party backends, which would need some way to know that there
are positional values in the query or would need an easier way of
injecting columns in to the select without resorting to the simple front
loading.

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

Django

unread,
Nov 4, 2013, 8:39:32 AM11/4/13
to django-...@googlegroups.com
#21252: Positional column numbers is not always correct for ORDER BY and GROUP BY
-------------------------------------+-------------------------------------

Reporter: manfre | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by akaariai):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

I agree. Seems to be issue only in DateQueries, and hopefully that area
will be improved soonish.

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

Django

unread,
Oct 7, 2015, 3:05:20 PM10/7/15
to django-...@googlegroups.com
#21252: Positional column numbers is not always correct for ORDER BY and GROUP BY
-------------------------------------+-------------------------------------

Reporter: manfre | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by timgraham):

It's unclear to me what needs to be done to resolve this ticket. Michael,
could you say if this is still an issue and elaborate if so?

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

Django

unread,
Oct 8, 2015, 12:32:29 AM10/8/15
to django-...@googlegroups.com
#21252: Positional column numbers is not always correct for ORDER BY and GROUP BY
-------------------------------------+-------------------------------------
Reporter: manfre | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Comment:

It seems Django doesn't anymore generate queries of the form ORDER BY 1.
Thus, I think we can close this ticket. If there are indeed places where
Django generates such queries (instead of the user explicitly asking for
such queries), then please reopen.

I'll resolve as fixed due to the fact that we have removed DateQueryset.

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

Reply all
Reply to author
Forward
0 new messages