For all I know, you cannot wrap an aggregate function. You have to write your own aggregate function.
If you write your own function, you may run into incompatibilies when upgrading or porting to another database. So, personally, I wouldn't bother and just add the delimiter to string_agg()
on every call. It really isn't that much of a pain.
That said, it's not that complicated to write your own aggregate function, either:
A custom final function:
CREATE FUNCTION f_str_agg_final(anyarray)
RETURNS text LANGUAGE SQL AS
$func$SELECT array_to_string($1, ', ')$func$;
The aggregate:
CREATE AGGREGATE f_str_agg (anyelement) (
SFUNC = array_append
,STYPE = anyarray
,INITCOND = '{}'
,FINALFUNC = f_str_agg_final
);
Call:
SELECT f_str_agg (kat) from tbl;
Works for almost any type - except for array types. You would have to modify your aggregate for this. More in this closely related answer on SOanswer on SO.