From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexey Dokuchaev <danfe@nsu.ru>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics
Date: Mon, 21 May 2018 12:20:52 -0400
Message-ID: <5595.1526919652@sss.pgh.pa.us> (raw)
In-Reply-To: <20180521162831.GA97361@regency.nsu.ru>
References: <20180521125441.GA85087@regency.nsu.ru>
<CAKFQuwaQ_jGJF5OZEvfz=J99BS5i6BeBZO+35RQnK-foBo1EPQ@mail.gmail.com>
<30939.1526913927@sss.pgh.pa.us>
<20180521162831.GA97361@regency.nsu.ru>
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 ...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, danfe@nsu.ru, david.g.johnston@gmail.com
Subject: Re: Aggregate functions with FROM clause and ROW_COUNT diagnostics
In-Reply-To: <5595.1526919652@sss.pgh.pa.us>
References: <20180521125441.GA85087@regency.nsu.ru> <CAKFQuwaQ_jGJF5OZEvfz=J99BS5i6BeBZO+35RQnK-foBo1EPQ@mail.gmail.com> <30939.1526913927@sss.pgh.pa.us> <20180521162831.GA97361@regency.nsu.ru> <5595.1526919652@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox