#21251: Not all database backends support grouping by a column number
-------------------------------------+-------------------------------------
     Reporter:  manfre               |                    Owner:  manfre
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  mssql                |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * stage:  Unreviewed => Accepted


Comment:

 ORDER BY 1 isn't available to user, but it is used internally for at least
 date queries. See sql/subqueries.py:L238 in current master. The aggregate
 case is hit by aggregation_regress.test_more_more_more():L573. The query
 is this:
 {{{
 qs =
 
Book.objects.annotate(num_authors=Count('authors')).filter(num_authors=2).dates('pubdate',
 'day')
 }}}

 There is another similar test, aggregation.test_dates_with_aggregation().
 These seem to be the only case where ORDER BY 1 ends up in GROUP BY, so
 this isn't a common issue at all.

 The queries generated by .dates() have used ORDER BY 1 from at least
 Django 1.2. I didn't check further.

 Option 2) might be hard to implement, but would of course be a better
 solution than 1).

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.09cf701119303743c5cce534e5fc2c9c%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to