#25081: QuerySet.get() ignores order_by in DISTINCT ON queries
-------------------------------------+-------------------------------------
     Reporter:  pdewacht             |                    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
-------------------------------------+-------------------------------------
Changes (by charettes):

 * cc: charettes (added)
 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * version:  1.8 => master
 * needs_docs:   => 0
 * stage:  Unreviewed => Accepted


Comment:

 Managed to reproduce against master. The culprit seems to be
 
[https://github.com/django/django/blob/f87e552d9842ff9591a9c51ebdb5f96e4dd54b00/django/db/models/query.py#L379-L380
 an ordering clearing] when limits have been set.

 I'm actually running the test suite with those lines removed since I can't
 think of a reason this is required.

 e.g. Why do ordering should be cleared in this case

 {{{#!python
 Foo.objects.order_by('bar').get()
 }}}

 But not this one
 {{{#!python
 Foo.objects.order_by('bar')[10:20].get()
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25081#comment:1>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.59fb6f41ed37554b9cab32b05bcb995f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to