Hi,
While running 2 sessions in different terminals for the same user, what
happens in the second session here looks a bit weird:
=========
<session 1>
=========
db=# create temp table t_test (id int);
CREATE TABLE
db=# select table_schema from information_schema.tables
where table_name = 't_test';
table_schema
--------------
pg_temp_2
(1 row)
db=# select has_schema_privilege('pg_temp_2', 'usage');
has_schema_privilege
----------------------
t
(1 row)
db=# select has_table_privilege('pg_temp_2.t_test', 'insert');
has_table_privilege
---------------------
t
(1 row)
db=# select has_table_privilege('t_test', 'insert');
has_table_privilege
---------------------
t
(1 row)
db=# insert into t_test values (1);
INSERT 0 1
=========
<session 2>
=========
db=# select table_schema from information_schema.tables
where table_name = 't_test';
table_schema
--------------
pg_temp_2
(1 row)
db=# select has_schema_privilege('pg_temp_2', 'usage');
has_schema_privilege
----------------------
t
(1 row)
db=# select has_table_privilege('pg_temp_2.t_test', 'insert');
has_table_privilege
---------------------
t
(1 row)
db=# select has_table_privilege('t_test', 'insert');
ERROR: relation "t_test" does not exist
db=# insert into t_test values (1);
ERROR: relation "t_test" does not exist
db=# select version();
version
------------------------------------------------------------------------
PostgreSQL 8.1.3 on i586-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
(1 row)
In this light, is there a possibility to find out what schema will be used for
temporary tables created during the current session? I need to find out
whether a specific temporary table exists and is accessible for the current
user in the current session.
--
Best,
Frank.