#32811: Annotate removes Meta.ordering
-------------------------------------+-------------------------------------
               Reporter:  pirelle    |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.2
  layer (models, ORM)                |
               Severity:  Release    |       Keywords:
  blocker                            |
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 This is very simplified example

 {{{
 In [5]: str(Order.objects.values("id", "ordered_at").all().query)
 Out[5]: 'SELECT "orders_order"."id", "orders_order"."ordered_at" FROM
 "orders_order" ORDER BY "orders_order"."ordered_at" DESC'

 In [6]: str(Order.objects.values("id",
 "ordered_at").annotate(c=Count("id")).all().query)
 Out[6]: 'SELECT "orders_order"."id", "orders_order"."ordered_at",
 COUNT("orders_order"."id") AS "c" FROM "orders_order" GROUP BY
 "orders_order"."id"'
 }}}
 As you can see ORDER BY disappears when annotate with Count exists.
 It used to work on 3.0, but stopped working in 3.1 and 3.2

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32811>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.c0f80843eadf63a337cf739184a1b425%40djangoproject.com.

Reply via email to