Re: proposal for 8.5, listagg aggregate function, WIP patch
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2009-12-25T21:29:16Z
Lists: pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes: > I propose a new aggregate function - listagg. This function > concatenate values to string. If this function is used with two > parameters, then second parameter is used as delimiter. NULL input > values are ignored like other aggregates. If all values are NULL, then > result is NULL. When delimiter is omitted, then values are > concatenated without any delimiter. The main objection I have to this proposal is the name: listagg seems pretty horrid. It's got nothing to do with lists, and it doesn't even attempt to be consistent with other existing function names. I can see a couple of different approaches that might make sense for choosing a better name. One is "something_to_string", though I'm not sure what "something" should be --- maybe "rows" or "set"? The other approach is to name it something based on concat() on the grounds that it's a form of concatenation, and we do have "concat" in the standard in the guise of XMLCONCAT. For instance there's some case for concat_agg() by analogy to array_agg(); though personally I think array_agg() is a horrid name too and not one of the SQL committee's better efforts. regards, tom lane