Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)
Date
Msg-id 27107.1281032735@sss.pgh.pa.us
Whole thread Raw
In response to Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)  ("David E. Wheeler" <david@kineticode.com>)
Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)  (Alex Hunsaker <badalex@gmail.com>)
List pgsql-hackers
I wrote:
> Well, I forgot that an aggregate involves more than one catalog row ;-).
> So it's a bit bigger patch than that, but still pretty small and safe.
> See attached.

Applied to HEAD and 9.0.  The mistaken case will now yield this:

regression=# select string_agg(f1 order by f1, ',') from text_tbl;
ERROR:  function string_agg(text) does not exist
LINE 1: select string_agg(f1 order by f1, ',') from text_tbl;              ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

It's not perfect (I don't think it's practical to get the HINT to
read "Put the ORDER BY at the end" ;-)) but at least it should
get people pointed in the right direction when they do this.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: remove upsert example from docs
Next
From: Peter Eisentraut
Date:
Subject: Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)