Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexey Dokuchaev <danfe(at)nsu(dot)ru>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics
Date: 2018-05-21 16:20:52
Message-ID: 5595.1526919652@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alexey Dokuchaev <danfe(at)nsu(dot)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 ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2018-05-21 16:26:48 Re: Will Altering and Modifying tables during backup result in a corrupted server after the restore?
Previous Message Alvaro Aguayo Garcia-Rada 2018-05-21 16:19:46 Re: Will Altering and Modifying tables during backup result in a corrupted server after the restore?