test.sql
application/sql
drop function if exists execute_into_test cascade;
drop type if exists execute_into_test cascade;
create type eitype as (i integer, y integer);
create or replace function execute_into_test() returns eitype as $$
declare
_v eitype;
begin
execute 'select 1,2' into _v;
return _v;
end; $$ language plpgsql;
COPY (SELECT 1 from generate_series(1,1) g) TO stdout WITH (format json);
COPY (SELECT g from generate_series(1,1) g) TO stdout WITH (format json);
COPY (SELECT g,1 from generate_series(1,1) g) TO stdout WITH (format json);
COPY (select * from execute_into_test()) TO stdout WITH (format json);
COPY (select * from execute_into_test() sub) TO stdout WITH (format json);
COPY (select sub from execute_into_test() sub) TO stdout WITH (format json);
COPY (select sub.i from execute_into_test() sub) TO stdout WITH (format json);
COPY (select sub.y from execute_into_test() sub) TO stdout WITH (format json);