| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера