has_table/schema_privilige() returns incorrect info on temp tables

Поиск
Список
Период
Сортировка
От Frank van Vugt
Тема has_table/schema_privilige() returns incorrect info on temp tables
Дата
Msg-id 200602272201.17363.ftm.van.vugt@foxi.nl
обсуждение исходный текст
Ответы Re: has_table/schema_privilige() returns incorrect info on temp tables  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: has_table/schema_privilige() returns incorrect info on temp tables  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Список pgsql-bugs
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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2285: Can not access database after successful PITR - file naming problems
Следующее
От: Tom Lane
Дата:
Сообщение: Re: has_table/schema_privilige() returns incorrect info on temp tables