#26067: Orderable ArrayAgg and StringAgg
-------------------------------------+-------------------------------------
     Reporter:  fdh                  |                    Owner:  fdh
         Type:  New feature          |                   Status:  assigned
    Component:  contrib.postgres     |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  ArrayAgg StringAgg   |             Triage Stage:  Accepted
  ordering                           |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by fdh):

 As pointed out by Josh Smeaton in the mailing list
 [https://groups.google.com/forum/#!topic/django-developers/YCSDX3GApBM
 discussion]:
   Consider that any ordering added within *may* need to be contributed to
 GROUP BY, but I haven't read the documentation to say that is a
 requirement.

 In the Postgres' [https://www.postgresql.org/docs/9.5/static/functions-
 aggregate.html documentation] these aggregations are only mentioned as
 being special by meaningful difference in ordering input values:
   The aggregate functions array_agg, [...] string_agg, and xmlagg, as well
 as similar user-defined aggregate functions, produce meaningfully
 different result values depending on the order of the input values. This
 ordering is unspecified by default, but can be controlled by writing an
 ORDER BY clause within the aggregate call, as shown in Section 4.2.7.
 I don't think anything in the ORDER BY clause in the aggregation would
 have to be contributed to a GROUP BY clause in the surrounding query as
 the aggregation operation is independent of the grouping of the
 surrounding query.

--
Ticket URL: <https://code.djangoproject.com/ticket/26067#comment:4>
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/061.416d269a15dbdd99264cc58720e79419%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to