Re: Temporary tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Temporary tables
Дата
Msg-id 6294.1064682565@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Temporary tables  ("George A.J" <jinujosein@yahoo.com>)
Список pgsql-sql
"George A.J" <jinujosein@yahoo.com> writes:
> When i searched the pg_class i found the temp table name more than once. 
> ie, a temporary table is created for each connection.I cannot distingush 
> the temp tables. But the tables are in different schema.
> Is there a method to get the current temporary schema?

Not directly, but you could try something like
perform * from pg_class where  relname = 'mytable' and pg_table_is_visible(oid);if not found then ...  -- create the
table

The visibility test would not succeed for temp tables belonging to other
backends.  (If 'mytable' is also used as the name of a regular table
then this isn't quite good enough, but I think just avoiding such a name
collision is easier than extending the check to reject non-temp tables.)
        regards, tom lane


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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Temporary tables
Следующее
От: Bertrand Petit
Дата:
Сообщение: pg_class.relpages