Is it possible to create a table from a record? For example:
DO $$ DECLARE v1 RECORD; BEGIN SELECT 1 AS c INTO v1; CREATE TEMP TABLE temp AS SELECT v1.*; END; $$ LANGUAGE 'plpgsql';
ERROR: record type has not been registered CONTEXT: SQL statement "CREATE TEMP TABLE temp AS SELECT v1.*" PL/pgSQL function inline_code_block line 6 at SQL statement
I tried more complex solutions such as using hstore to loop through the record keys and create a custom command but then I would not be able to use the same data types.