Skip to content

Instantly share code, notes, and snippets.

@ryandotsmith
Created January 23, 2013 05:19
Show Gist options
  • Save ryandotsmith/4602274 to your computer and use it in GitHub Desktop.
Save ryandotsmith/4602274 to your computer and use it in GitHub Desktop.
Postgres array concatenation aggregate function.
CREATE AGGREGATE array_accum (anyarray)
(
sfunc = array_cat,
stype = anyarray,
initcond = '{}'
);
@megagreg72
Copy link

megagreg72 commented Aug 1, 2024

had to change it for pg 14:

CREATE AGGREGATE array_accum (anycompatiblearray)
(
    sfunc = array_cat,
    stype = anycompatiblearray,
    initcond = '{}'
);  

Thanks, this version worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment