+
+-- Own function
+CREATE FUNCTION space_concat(text, text) RETURNS text
+ AS $_$select case
+WHEN $2 is null or $2 = '' THEN $1
+WHEN $1 is null or $1 = '' THEN $2
+ELSE $1 || ' ' || $2
+END$_$
+ LANGUAGE sql;
+
+CREATE AGGREGATE space_separated_list (
+ BASETYPE = text,
+ SFUNC = space_concat,
+ STYPE = text,
+ INITCOND = ''
+);