Re: Finding if a temp table exists in the current connection

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Finding if a temp table exists in the current connection
Дата
Msg-id 5648.1049468304@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Finding if a temp table exists in the current connection  (Christoph Haller <ch@rodos.fzk.de>)
Список pgsql-sql
Christoph Haller <ch@rodos.fzk.de> writes:
> It looks like they are created in name spaces called "pg_temp_<N>,
> where N is simply a connection counter.

Right.  If you are trying to find out which N applies to your session,
here is one way:

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

regression=# create temp table z(f1 int);
CREATE TABLE
regression=# select current_schemas(true);       current_schemas
-------------------------------{pg_temp_2,pg_catalog,public}
(1 row)
        regards, tom lane



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

Предыдущее
От: Christoph Haller
Дата:
Сообщение: Re: Finding if a temp table exists in the current connection
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: can i make this sql query more efficiant?