Hello It is maybe a bug. I cannot use ORDER BY clause in two parameter aggregate.
create aggregate la(text, text) (SFUNC=listagg2_transfn, STYPE=internal, FINALFUNC=listagg_finalfn); postgres=# select la(town,',') from country; la ------------------------------- Prague,Brno,Bratislava,Kosice (1 row) but when I add ORDER BY clause postgres=# select la(town order by town,',') from country; ERROR: function la(character varying) does not exist LINE 1: select la(town order by town,',') from country; ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. postgres=# Probably it don't use correct count of parameters, because when I add one parameter aggregate: postgres=# create aggregate la(text) (SFUNC=listagg1_transfn, STYPE=internal, FINALFUNC=listagg_finalfn); CREATE AGGREGATE postgres=# select la(town order by town,',') from country; la ---------------------------- BratislavaBrnoKosicePrague (1 row) Then it working, but it call wrong aggregates. Regards Pavel Stehule -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers