test_tblspace2.sql
application/x-sql
\timing off select current_user; show role; show temp_tablespaces; \db+ rn_temp_01 \echo create function test_func () returns int language plpgsql security definer as 'begin create temporary table test2 (a int); return 1; end;'; create function test_func () returns int language plpgsql security definer as 'begin create temporary table test2 (a int); return 1; end;'; \df+ test_func \echo drop role if exists test_role; drop role if exists test_role; \echo create role test_role; create role test_role; \echo set role test_role; set role test_role; \echo create temporary table test (a int); create temporary table test (a int); select relname,reltablespace from pg_class where relname = 'test'; select test_func(); select relname,reltablespace from pg_class where relname = 'test2';