Skip to content

Instantly share code, notes, and snippets.

@matheusoliveira
Last active February 22, 2017 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheusoliveira/dc02ee13e10c7251c5cff38f4427d138 to your computer and use it in GitHub Desktop.
Save matheusoliveira/dc02ee13e10c7251c5cff38f4427d138 to your computer and use it in GitHub Desktop.
CREATE OR REPLACE FUNCTION wm_concat_finalfn(anyarray)
RETURNS text
LANGUAGE SQL
IMMUTABLE AS $$
SELECT array_to_string($1, ',');
$$;
DROP AGGREGATE IF EXISTS wm_concat(anyelement);
CREATE AGGREGATE wm_concat(anyelement) (
SFUNC = array_append,
STYPE = anyarray,
FINALFUNC = wm_concat_finalfn
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment