Re: Which Schema I am working on??

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Which Schema I am working on??
Дата
Msg-id 4336.1058293480@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Which Schema I am working on??  (Harry Yau <harry@aurasound.com.hk>)
Список pgsql-general
Harry Yau <harry@aurasound.com.hk> writes:
>   I am writing a pl/psql function with a temp table right now.
> It creates the temp table inside. Whenever I call this function in a
> session for the first time, it creates a shema, namely pg_temp_number,
> automatically and it creates the temp table within the schema. I've
> tried to add a check inside the function to check have the temp table
> been already existed.

Try something like

IF EXISTS(SELECT 1 FROM pg_class
          WHERE relname = 'tablexxx' AND pg_table_is_visible(oid))
THEN ... drop it ...

The visibility check will reject temp tables belonging to other
sessions.

            regards, tom lane

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

Предыдущее
От: Frank Finner
Дата:
Сообщение: Re: Are you frustrated with PostgreSQL
Следующее
От: "Vincent Hikida"
Дата:
Сообщение: Re: Fw: select null + 0 question