create function join_str_sfunc(TEXT, TEXT) returns TEXT as ' select case when $1 = '''' then $2 when $2 = '''' then $1 else $1 || '' '' || $2 end ' language 'sql';
create aggregate join_str ( basetype = text , sfunc = join_str_sfunc , stype = text , initcond = '' );