Monday, November 24, 2008

array_agg for PostgreSQL 8.2.5

In relation with article by Hubert Lubaczewski 'Waiting for 8.4 - array aggregate and array unpacker', I have the need to use the former for my project, in PostgreSQL 8.2.5. Following is the aggregate function:

CREATE AGGREGATE array_agg(anyelement) (
SFUNC=array_append,
STYPE=anyarray,
INITCOND='{}'
);