The current docs can be read as using DISTINCT in an aggregate
(count(distinct col)) and ORDER BY (array_agg(col ORDER BY col)) are
both extensions to the standard.
The actual truth is that our extension to the standard is to allow both
at the same time.
Attached is a trivial patch to make that more clear. I don't know if
pgindent works on the docs so I made this so as to show what is
changing. I can submit a properly formatted patch, or let the eventual
committer make that change if necessary.
--
Vik Fearing
diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml
index 93ad71737f..4aecefae8a 100644
--- a/doc/src/sgml/syntax.sgml
+++ b/doc/src/sgml/syntax.sgml
@@ -1634,6 +1634,7 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
<note>
<para>
The ability to specify both <literal>DISTINCT</literal> and <literal>ORDER BY</literal>
+ at the same time
in an aggregate function is a <productname>PostgreSQL</productname> extension.
</para>
</note>