In the attached script, second call to test1() causes error:
select test1();test1
------- 0
(1 row)
select test1();
psql:/home/t-ishii/tmp/aaa.sql:13: NOTICE: Error occurred while executing PL/pgSQL function test1
psql:/home/t-ishii/tmp/aaa.sql:13: NOTICE: line 5 at select into variables
psql:/home/t-ishii/tmp/aaa.sql:13: ERROR: Relation 422543 does not exist
Maybe PL/pgSQL cache problem?
--
Tatsuo Ishii
----------------------------------------------------------------------
drop function test1();
create function test1() returns int as '
declare
rec RECORD;
begin
create temp table temp_aaa (i int);
select into rec * from temp_aaa;
drop table temp_aaa;
return 0;
end;
'language 'plpgsql';
select test1();
select test1();