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: array_agg.tar.gz
Description: application/compressed-tar

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to