#32658: Subquery ignores query ordering
-------------------------------------+-------------------------------------
     Reporter:  Bálint Balina        |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  Subquery,            |             Triage Stage:
  annotations, ordering              |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

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


Comment:

 `ORDER BY` clause should be included in the `GROUP_CONCAT()` not in the
 main query, e.g. `GROUP_CONCAT(U0."name" ORDER BY U0."name" ASC) AS
 "child_names")`. You can check
 
[https://github.com/django/django/blob/413c15ef2e3d3958fb641a023bc1e2d15fb2b228/django/contrib/postgres/aggregates/mixins.py#L4-L48
 OrderableAggMixin] to see how it's implemented for `ArrayAgg`,
 `StringAgg`, and `JSONBAgg` on PostgreSQL.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32658#comment:6>
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/075.c761e0350272ca64cf8d7e320736a0af%40djangoproject.com.

Reply via email to