summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorFloris den Hengst <florisdenhengst@gmail.com>2016-07-05 11:47:24 +0200
committerTim Graham <timograham@gmail.com>2018-06-28 20:29:33 -0400
commit96199e562dcc409ab4bdc2b2146fa7cf73c7c5fe (patch)
treecb047cbe692bfe22a10b25b1336730079ec027bf /docs/ref
parent2a0116266c4d81bd1cc4e3ea20efe9a7874f481b (diff)
Fixed #26067 -- Added ordering support to ArrayAgg and StringAgg.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/postgres/aggregates.txt31
1 files changed, 29 insertions, 2 deletions
diff --git a/docs/ref/contrib/postgres/aggregates.txt b/docs/ref/contrib/postgres/aggregates.txt
index 480c230c40..a605bc831c 100644
--- a/docs/ref/contrib/postgres/aggregates.txt
+++ b/docs/ref/contrib/postgres/aggregates.txt
@@ -22,7 +22,7 @@ General-purpose aggregation functions
``ArrayAgg``
------------
-.. class:: ArrayAgg(expression, distinct=False, filter=None, **extra)
+.. class:: ArrayAgg(expression, distinct=False, filter=None, ordering=(), **extra)
Returns a list of values, including nulls, concatenated into an array.
@@ -31,6 +31,22 @@ General-purpose aggregation functions
An optional boolean argument that determines if array values
will be distinct. Defaults to ``False``.
+ .. attribute:: ordering
+
+ .. versionadded:: 2.2
+
+ An optional string of a field name (with an optional ``"-"`` prefix
+ which indicates descending order) or an expression (or a tuple or list
+ of strings and/or expressions) that specifies the ordering of the
+ elements in the result list.
+
+ Examples::
+
+ 'some_field'
+ '-some_field'
+ from django.db.models import F
+ F('some_field').desc()
+
``BitAnd``
----------
@@ -73,7 +89,7 @@ General-purpose aggregation functions
``StringAgg``
-------------
-.. class:: StringAgg(expression, delimiter, distinct=False, filter=None)
+.. class:: StringAgg(expression, delimiter, distinct=False, filter=None, ordering=())
Returns the input values concatenated into a string, separated by
the ``delimiter`` string.
@@ -87,6 +103,17 @@ General-purpose aggregation functions
An optional boolean argument that determines if concatenated values
will be distinct. Defaults to ``False``.
+ .. attribute:: ordering
+
+ .. versionadded:: 2.2
+
+ An optional string of a field name (with an optional ``"-"`` prefix
+ which indicates descending order) or an expression (or a tuple or list
+ of strings and/or expressions) that specifies the ordering of the
+ elements in the result string.
+
+ Examples are the same as for :attr:`ArrayAgg.ordering`.
+
Aggregate functions for statistics
==================================