Re: has_table/schema_privilige() returns incorrect info on temp tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: has_table/schema_privilige() returns incorrect info on temp tables
Дата
Msg-id 22201.1141075161@sss.pgh.pa.us
обсуждение исходный текст
Ответ на has_table/schema_privilige() returns incorrect info on temp tables  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Список pgsql-bugs
Frank van Vugt <ftm.van.vugt@foxi.nl> writes:
> While running 2 sessions in different terminals for the same user, what
> happens in the second session here looks a bit weird:

In the first place, you are evidently running as superuser, which means
that has_foo_privilege will ALWAYS say 't' (except possibly if the
target object doesn't exist, in which case I think you get an error).
In the second place, trying to access another session's temp table is
unsupported.

> In this light, is there a possibility to find out what schema will be used for
> temporary tables created during the current session?

After you've created at least one temp table, you can look at the result
of "current_schemas(true)".  There's no guarantee that the schema even
exists before you've created something...


regression=# select current_schemas(true);
   current_schemas
---------------------
 {pg_catalog,public}
(1 row)

regression=# create temp table t(f1 int);
CREATE TABLE
regression=# select current_schemas(true);
        current_schemas
-------------------------------
 {pg_temp_1,pg_catalog,public}
(1 row)

regression=# select (current_schemas(true))[1];
 current_schemas
-----------------
 pg_temp_1
(1 row)

regression=#

            regards, tom lane

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

Предыдущее
От: Frank van Vugt
Дата:
Сообщение: has_table/schema_privilige() returns incorrect info on temp tables
Следующее
От: Frank van Vugt
Дата:
Сообщение: Re: has_table/schema_privilige() returns incorrect info on temp tables