ORDER BY clause in aggregate doesn't work well with multi argument aggregates

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема ORDER BY clause in aggregate doesn't work well with multi argument aggregates
Дата
Msg-id 162867790912251040q5bb0e4bfrf777b9305a601300@mail.gmail.com
обсуждение исходный текст
Ответы Re: ORDER BY clause in aggregate doesn't work well with multi argument aggregates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: PQescapeByteaConn and the new hex encoding
Следующее
От: Tom Lane
Дата:
Сообщение: Re: info about patch: using parametrised query in psql