Re: BUG #18443: jsonb_agg issue. Again.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #18443: jsonb_agg issue. Again.
Дата
Msg-id CAKFQuwY4SWR6WqUp5DwauLMumJhr71+FFcY-qMFLFMqfq+fCzg@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #18443: jsonb_agg issue. Again.  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18443: jsonb_agg issue. Again.  (Ц <pfunk@mail.ru>)
Список pgsql-bugs
On Fri, Apr 19, 2024 at 8:25 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      18443
Logged by:          Alexander Tsaregorodtsev
Email address:      pfunk@mail.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.

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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18443: jsonb_agg issue. Again.
Следующее
От: Ц
Дата:
Сообщение: Re: BUG #18443: jsonb_agg issue. Again.