Array agg

From PostgreSQL wiki
Jump to navigationJump to search

Compatibility Snippets

Compatibility function for array_agg for < 8.4

Works with PostgreSQL

Any version

Written in

SQL

Depends on

Nothing

This aggregate can be used in place of the built-in array_agg in PostgreSQL versions less than 8.4.

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