Re: string_agg delimiter having no effect with order by

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Alex Hunsaker <badalex(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: string_agg delimiter having no effect with order by
Date: 2010-08-05 15:47:02
Message-ID: 2631.1281023222@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> but still when we remove one parametric string_agg, then this issue
> will not be documented.

How so? This paragraph will still be there:

<para>
When dealing with multiple-argument aggregate functions, note that the
<literal>ORDER BY</> clause goes after all the aggregate arguments.
For example, this:
<programlisting>
SELECT string_agg(a, ',' ORDER BY a) FROM table;
</programlisting>
not this:
<programlisting>
SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
</programlisting>
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>

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2010-08-05 16:28:20 Re: BUG #5599: Vacuum fails due to index corruption issues
Previous Message Thom Brown 2010-08-05 15:40:58 Re: string_agg delimiter having no effect with order by

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2010-08-05 15:47:54 Re: MERGE Specification
Previous Message Simon Riggs 2010-08-05 15:43:34 Concurrent MERGE