From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | pfunk(at)mail(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18443: jsonb_agg issue. Again. |
Date: | 2024-04-19 15:34:34 |
Message-ID: | CAKFQuwY4SWR6WqUp5DwauLMumJhr71+FFcY-qMFLFMqfq+fCzg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Apr 19, 2024 at 8:25 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 18443
> Logged by: Alexander Tsaregorodtsev
> Email address: pfunk(at)mail(dot)ru
> PostgreSQL version: 12.18
> Operating system: Official docker container
> Description:
>
> Greetings!
> Is it expected behavior?
>
>
> --simple function raising ONE notice and returning record of 2 int`s
> drop function if exists public.out2(jsonb);
> create or replace function public.out2(_in jsonb, a out int, b out int)
> returns record
> as
> $body$
> begin
> raise notice '***';
> end;
> $body$
> language plpgsql;
>
> --similar function raising notice but returning record of 3 int`s
> drop function if exists public.out3();
> create or replace function public.out3(_in jsonb, a out int, b out int, c
> out int)
> returns record
>
> --Problem! function out2 has invoked 2 times (two NOTICE`s and accidentally
> number of output parameters)
> select (public.out2(jsonb_agg(jsonb_build_object('col', col)))).* --,
> jsonb_agg(jsonb_build_object('col', col))
> from tmp_view;
>
>
You wrote a table-producing function (one row but three columns). Those
need [1] to be executed in the FROM clause, via an implicit or explicit
LATERAL join if you have data from other relations being fed in as input
arguments.
David J.
1. well, at least if you don't want to see this kind of artifact where the
way to expand .* is to copy the expression preceding it.
From | Date | Subject | |
---|---|---|---|
Next Message | Ц | 2024-04-19 17:21:14 | Re: BUG #18443: jsonb_agg issue. Again. |
Previous Message | PG Bug reporting form | 2024-04-19 14:09:26 | BUG #18443: jsonb_agg issue. Again. |