diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 7c3e940afe..35d8924c6b 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -20273,6 +20273,18 @@ SELECT NULLIF(value, '(none)') ...
    aggregation.
   </para>
 
+  <note>
+   <para>
+    The aggregates in this section all accept an optional <literal>ORDER
+    BY</literal> clause as described in the general syntax rules
+    for aggregates (see <xref linkend="syntax-aggregates" />).
+    <literal>input_sort_expr</literal> specifies the column names to sort
+    by before being supplied to the aggreagate function.  For example,
+    <literal>array_agg(... ORDER BY ...)</literal> produces an array with
+    ordered values.
+   </para>
+  </note>
+
    <table id="functions-aggregate-table">
     <title>General-Purpose Aggregate Functions</title>
     <tgroup cols="2">
@@ -20310,7 +20322,7 @@ SELECT NULLIF(value, '(none)') ...
         <indexterm>
          <primary>array_agg</primary>
         </indexterm>
-        <function>array_agg</function> ( <type>anynonarray</type> )
+        <function>array_agg</function> ( <type>anynonarray</type> <literal>ORDER BY</literal> <literal>input_sort_expr</literal>)
         <returnvalue>anyarray</returnvalue>
        </para>
        <para>
@@ -20321,7 +20333,7 @@ SELECT NULLIF(value, '(none)') ...
 
       <row>
        <entry role="func_table_entry"><para role="func_signature">
-        <function>array_agg</function> ( <type>anyarray</type> )
+        <function>array_agg</function> ( <type>anyarray</type> <literal>ORDER BY</literal> <literal>input_sort_expr</literal> )
         <returnvalue>anyarray</returnvalue>
        </para>
        <para>
@@ -20356,11 +20368,11 @@ SELECT NULLIF(value, '(none)') ...
         <returnvalue>numeric</returnvalue>
        </para>
        <para role="func_signature">
-        <function>avg</function> ( <type>real</type> )
+        <function>avg</function> ( <type>real</type> <optional> <literal>ORDER BY</literal> <literal>input_sort_expr</literal> </optional> )
         <returnvalue>double precision</returnvalue>
        </para>
        <para role="func_signature">
-        <function>avg</function> ( <type>double precision</type> )
+        <function>avg</function> ( <type>double precision</type> <optional> <literal>ORDER BY</literal> <literal>input_sort_expr</literal> </optional> )
         <returnvalue>double precision</returnvalue>
        </para>
        <para role="func_signature">
@@ -20526,14 +20538,14 @@ SELECT NULLIF(value, '(none)') ...
         <indexterm>
          <primary>json_agg</primary>
         </indexterm>
-        <function>json_agg</function> ( <type>anyelement</type> )
+        <function>json_agg</function> ( <type>anyelement</type> <literal>ORDER BY</literal> <literal>input_sort_expr</literal> )
         <returnvalue>json</returnvalue>
        </para>
        <para role="func_signature">
         <indexterm>
          <primary>jsonb_agg</primary>
         </indexterm>
-        <function>jsonb_agg</function> ( <type>anyelement</type> )
+        <function>jsonb_agg</function> ( <type>anyelement</type> <literal>ORDER BY</literal> <literal>input_sort_expr</literal> )
         <returnvalue>jsonb</returnvalue>
        </para>
        <para>
@@ -20573,7 +20585,8 @@ SELECT NULLIF(value, '(none)') ...
         </indexterm>
         <function>json_object_agg</function> ( <parameter>key</parameter>
          <type>"any"</type>, <parameter>value</parameter>
-         <type>"any"</type> )
+         <type>"any"</type>
+         <literal>ORDER BY</literal> <literal>input_sort_expr</literal> )
         <returnvalue>json</returnvalue>
        </para>
        <para role="func_signature">
@@ -20582,7 +20595,8 @@ SELECT NULLIF(value, '(none)') ...
         </indexterm>
         <function>jsonb_object_agg</function> ( <parameter>key</parameter>
          <type>"any"</type>, <parameter>value</parameter>
-         <type>"any"</type> )
+         <type>"any"</type>
+         <literal>ORDER BY</literal> <literal>input_sort_expr</literal> )
         <returnvalue>jsonb</returnvalue>
        </para>
        <para>
@@ -20819,7 +20833,8 @@ SELECT NULLIF(value, '(none)') ...
        </para>
        <para role="func_signature">
         <function>string_agg</function> ( <parameter>value</parameter>
-         <type>bytea</type>, <parameter>delimiter</parameter> <type>bytea</type> )
+         <type>bytea</type>, <parameter>delimiter</parameter> <type>bytea</type>
+         <literal>ORDER BY</literal> <literal>input_sort_expr</literal> )
         <returnvalue>bytea</returnvalue>
        </para>
        <para>
@@ -20851,11 +20866,11 @@ SELECT NULLIF(value, '(none)') ...
         <returnvalue>numeric</returnvalue>
        </para>
        <para role="func_signature">
-        <function>sum</function> ( <type>real</type> )
+        <function>sum</function> ( <type>real</type> <optional> <literal>ORDER BY</literal> <literal>input_sort_expr</literal> </optional> )
         <returnvalue>real</returnvalue>
        </para>
        <para role="func_signature">
-        <function>sum</function> ( <type>double precision</type> )
+        <function>sum</function> ( <type>double precision</type> <optional> <literal>ORDER BY</literal> <literal>input_sort_expr</literal> </optional> )
         <returnvalue>double precision</returnvalue>
        </para>
        <para role="func_signature">
@@ -20877,7 +20892,7 @@ SELECT NULLIF(value, '(none)') ...
         <indexterm>
          <primary>xmlagg</primary>
         </indexterm>
-        <function>xmlagg</function> ( <type>xml</type> )
+        <function>xmlagg</function> ( <type>xml</type> <literal>ORDER BY</literal> <literal>input_sort_expr</literal> )
         <returnvalue>xml</returnvalue>
        </para>
        <para>
