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

Re: Review: listagg aggregate

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: "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 08:37:46
Message-ID: 162867791001280037o7724d210x379da466a84a7ef5@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
2010/1/28 Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>:
>
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
>> with actualised oids
>
> I'm checking the patch for commit, and have a couple of comments.
>
> * 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 I dislike it. This using is nonsense.

Regards
Pavel

>
> * Can we use StringInfo directly as the aggregate context instead of
>  StringAggState? For the first reason, we need to drop 'delimiter' field
>  from struct StringAggState. Now it has only StringInfo field.
>
> * We'd better avoiding to call text_to_cstring() for delimitors and elements
>  for performance reason. We can use appendBinaryStringInfo() here.
>
> My proposal patch attached.
>
> Also, I've not changed it yet, but it might be considerable:
>
> * Do we need better names for string_agg1_transfn and string_agg2_transfn?
>  They are almost "internal names", but we could have more
>  like string_agg_with_sep_transfn.
>
> Comments?
>
> Regards,
> ---
> Takahiro Itagaki
> NTT Open Source Software Center
>
>

In response to

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2010-01-28 08:38:10
Subject: Re: Review: listagg aggregate
Previous:From: Heikki LinnakangasDate: 2010-01-28 08:28:26
Subject: Re: Streaming replication and pg_xlogfile_name()

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