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.
Do you mean select (out3).* .. equal to select (out3).col1, (out3).col3, (out3).col3 … ?
Didn`t even suppose that..
Sometimes I've used (row).col or (row).* in select list.
Would be appreciated if you could provide keywords for googling.
And yeah, after hours of confusion rewrote it to:
select o.*
from
(select jsonb_agg(t) as jsonbagg from tmp_view t) j
, lateral public.out3(j.jsonbagg) o;
And it works just fine!