Postgresql – How to fetch from cursor over single column of composite type into a variable of that type in PL/pgSQL?
Given: CREATE TYPE my_struct AS ( a int4, b text, c float4 ); DO $$ DECLARE my_cursor refcursor; my_value my_struct; BEGIN OPEN my_cursor FOR SELECT (1, 'a', 10.0)::my_struct; FETCH my_cursor INTO my_value; -- ERROR! END $$ Postgres raises an error…