CREATE OR REPLACE FUNCTION _concat(IN str1 text, IN str2 text, OUT str text)
RETURNS text AS
$BODY$
BEGIN
str := '';
if str1 IS NOT NULL then
str := str ||str1 ;
end if;
if str2 IS NOT NULL then
str := str || str2 || ',';
end if;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION _concat(text, text)
OWNER TO engires301;
CREATE AGGREGATE concat (
BASETYPE = text,
SFUNC = _concat,
STYPE = text
);
RETURNS text AS
$BODY$
BEGIN
str := '';
if str1 IS NOT NULL then
str := str ||str1 ;
end if;
if str2 IS NOT NULL then
str := str || str2 || ',';
end if;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION _concat(text, text)
OWNER TO engires301;
CREATE AGGREGATE concat (
BASETYPE = text,
SFUNC = _concat,
STYPE = text
);