diff -r aff75b69db92 -r 2c48c091b6a2 schemas/_regproc.postgres.sql --- a/schemas/_regproc.postgres.sql Tue Jul 02 17:09:04 2013 +0200 +++ b/schemas/_regproc.postgres.sql Mon Jan 13 13:47:47 2014 +0100 @@ -10,10 +10,15 @@ SELECT array_to_string($1, ', ') $$ LANGUAGE SQL;; + +CREATE FUNCTION cw_array_append_unique (anyarray, anyelement) RETURNS anyarray AS $$ + SELECT array_append($1, (SELECT $2 WHERE $2 <> ALL($1))) +$$ LANGUAGE SQL + DROP AGGREGATE IF EXISTS group_concat (anyelement) CASCADE; CREATE AGGREGATE group_concat ( basetype = anyelement, - sfunc = array_append, + sfunc = cw_array_append_unique, stype = anyarray, finalfunc = comma_join, initcond = '{}'