From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal for 8.5, listagg aggregate function, WIP patch |
Date: | 2009-12-25 22:10:05 |
Message-ID: | 162867790912251410i1a54ad25ib2757dd714697e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2009/12/25 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> 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.
It is list - on application level - without arrays - was used list of
values separated by comma. I don't have a experience with Oracle. But
I know this term in this meaning from MSSQL.
>
> 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.
I don't know, who though up named this function in Oracle. This
functionality is known as "listagg" (Oracle) or "group_concat"
(MySQL). I don't thing we need a third name for it. group_concat has
enhanced syntax:
GROUP_CONCAT([DISTINCT] expr [,expr ...]
[ORDER BY {unsigned_integer | col_name | expr}
[ASC | DESC] [,col_name ...]]
[SEPARATOR str_val])
there are keyword SEPARATOR. Oracle's syntax is nearer to standard
PostgreSQL's syntax
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/functions087.htm
But Oracle has own syntax too. After some experience today, I see some
advantage Oracle's syntax over standard :).
This function isn't standardised now, so we can use any name. I vote
name used in Oracle db.
Regards
Pavel Stehule
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2009-12-25 22:27:44 | Re: creating index names automatically? |
Previous Message | Tom Lane | 2009-12-25 21:29:16 | Re: proposal for 8.5, listagg aggregate function, WIP patch |