Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics
От | Alexey Dokuchaev |
---|---|
Тема | Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics |
Дата | |
Msg-id | 20180521170113.GA6259@regency.nsu.ru обсуждение исходный текст |
Ответ на | Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics
|
Список | pgsql-general |
On Mon, May 21, 2018 at 12:20:52PM -0400, Tom Lane wrote: > Alexey Dokuchaev <danfe@nsu.ru> writes: > > On Mon, May 21, 2018 at 10:45:27AM -0400, Tom Lane wrote: > >> OP could do something like > >> select json_agg(_) as j, count(*) as c INTO r FROM ( > > > Thanks, I've arrived at the same solution (using local RECORD) eventually. > > It works as intended, but I still need to assign OUT parameters by hand: > > > retcode := tmp.c; > > result := tmp.j; > > Actually, it should work to do > > select json_agg(_), count(*) INTO result, retcode FROM ... Bingo! Thanks Tom, you're the best (as always). Quick reality check question: are count(*) vs. count(_) equivalent above? I vaguely recall that count(1) got somewhat slower than count(*) after 8.2, but cannot back it up right now. ./danfe
В списке pgsql-general по дате отправления: