1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Remove the single-argument form of string_agg(). It added nothing much in

functionality, while creating an ambiguity in usage with ORDER BY that at
least two people have already gotten seriously confused by.  Also, add an
opr_sanity test to check that we don't in future violate the newly minted
policy of not having built-in aggregates with the same name and different
numbers of parameters.  Per discussion of a complaint from Thom Brown.
This commit is contained in:
Tom Lane
2010-08-05 18:21:19 +00:00
parent fd1843ff89
commit b0c451e145
11 changed files with 85 additions and 77 deletions

View File

@@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.149 2010/08/04 15:27:57 tgl Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.150 2010/08/05 18:21:17 tgl Exp $ -->
<chapter id="sql-syntax">
<title>SQL Syntax</title>
@@ -1583,16 +1583,17 @@ SELECT array_agg(a ORDER BY b DESC) FROM table;
<para>
When dealing with multiple-argument aggregate functions, note that the
<literal>ORDER BY</> clause goes after all the aggregate arguments.
For example, this:
For example, write this:
<programlisting>
SELECT string_agg(a, ',' ORDER BY a) FROM table;
</programlisting>
not this:
<programlisting>
SELECT string_agg(a ORDER BY a, ',') FROM table; -- not what you want
SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
</programlisting>
The latter syntax will be accepted, but <literal>','</> will be
treated as a (useless) sort key.
The latter is syntactically valid, but it represents a call of a
single-argument aggregate function with two <literal>ORDER BY</> keys
(the second one being rather useless since it's a constant).
</para>
<para>