Skip site navigation (1) Skip section navigation (2)

Re: Review: listagg aggregate

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, "pgsql-hackers(at)postgresql(dot)org Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Review: listagg aggregate
Date: 2010-01-28 14:01:19
Message-ID: 162867791001280601y2839ffd6i5dee0b16418ec728@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
2010/1/28 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Thu, Jan 28, 2010 at 3:59 AM, Takahiro Itagaki
> <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
>> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>>
>>> 2010/1/28 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>>> > 2010/1/28 David E. Wheeler <david(at)kineticode(dot)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.

simplest could not be a best. There have to be only a const
expression. But we have not possibility to check it in pg.

Pavel



>
> ...Robert
>

In response to

Responses

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2010-01-28 14:10:43
Subject: can somebody execute this query on Oracle 11.2g and send result?
Previous:From: Robert HaasDate: 2010-01-28 13:53:26
Subject: Re: Review: listagg aggregate

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group