Re: Review: listagg aggregate - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Review: listagg aggregate
Date
Msg-id 603c8f071001280553w30eb9daeua8e1b8aca7704d8a@mail.gmail.com
Whole thread Raw
In response to Re: Review: listagg aggregate  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: Review: listagg aggregate  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On Thu, Jan 28, 2010 at 3:59 AM, Takahiro Itagaki
<itagaki.takahiro@oss.ntt.co.jp> wrote:
> Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
>> 2010/1/28 Pavel Stehule <pavel.stehule@gmail.com>:
>> > 2010/1/28 David E. Wheeler <david@kineticode.com>:
>> >> On Jan 27, 2010, at 6:47 PM, Takahiro Itagaki wrote:
>> >>
>> >>> * I think we cannot cache the delimiter at the first call.
>> >>>   For example,
>> >>>     SELECT string_agg(elem, delim)
>> >>>       FROM (VALUES('A', ','), ('B', '+'), ('C', '*')) t(elem, delim);
>> >>>   should return 'A+B*C' rather than 'A,B,C'.
>> >
>> > no, has not.
>> What is use case for this behave??
>
> I also think this usage is nonsense, but seems to be the most consistent
> behavior for me. I didn't say anything about use-cases, but just capability.
> Since we allow such kinds of usage for now, you need to verify the
> delimiter is not changed rather than ignoring it if you want disallow
> to change the delimiter during an aggregation.
>
> Of course you can cache the first delimiter at start, and check delimiters
> are not changed every calls -- but I think it is just a waste of cpu cycle.

Agreed.  Not caching it seems the simplest solution.

...Robert


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: make everything target
Next
From: Pavel Stehule
Date:
Subject: Re: Review: listagg aggregate