Re: proposal for 8.5, listagg aggregate function, WIP patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal for 8.5, listagg aggregate function, WIP patch
Date: 2009-12-25 21:29:16
Message-ID: 10960.1261776556@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2009-12-25 22:10:05 Re: proposal for 8.5, listagg aggregate function, WIP patch
Previous Message Matteo Beccati 2009-12-25 21:28:53 PHP and PostgreSQL 8.5 compatibility