Re: array_agg for 8.3

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Faheem Mitha <faheem(at)email(dot)unc(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: array_agg for 8.3
Date: 2009-01-17 18:43:01
Message-ID: 1232217781.7281.24.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 2009-01-17 at 02:09 -0500, Faheem Mitha wrote:
> Hi,
>
> Can anyone comment on the practicality of using the code for array_agg
> from the dev repos, file src/backend/utils/adt/array_userfuncs.c in 8.3 as
> a user defined function? It looks like this code was recently added, Nov
> 13th/14th. There are two functions, array_agg_transfn and
> array_agg_finalfn, but I'm not clear how to use them. The idea would be to
> compile and load them like as any other user-defined C function in 8.3. I
> was informed that directly trying to use these functions in 8.3 would not
> work. I realise this funcionality will be available in 8.4, but I don't
> want to wait.
>
> If anyone has working code along these lines, please send it to me. Also,
> please CC me on any reply. Thanks.

Hi,

I wrote a module that will include these functions in 8.3.

The reason it's not easy to just make them a normal UDF is because the
state type is "internal", and that's not allowed using regular SQL. I
got around this by updating the catalogs directly. I believe "internal"
is safe here because the state still uses one palloc() chunk (and it
matches the commit to 8.4, anyway).

Code review welcome.

Regards,
Jeff Davis

Attachment Content-Type Size
array_agg.tar.gz application/x-compressed-tar 2.9 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-01-17 18:58:13 Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)
Previous Message Gregory Stark 2009-01-17 17:55:20 Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)