Re: Check if table exists

Поиск
Список
Период
Сортировка
От Semyon Chaichenets
Тема Re: Check if table exists
Дата
Msg-id 6f81e0890903181021g2046c0p8f3b06aff8fff711@mail.gmail.com
обсуждение исходный текст
Ответ на Check if table exists  ("Leif B. Kristensen" <leif@solumslekt.org>)
Список pgsql-novice
Try

IF EXISTS (SELECT * FROM pg_table WHERE tablename=tmp_sources)
 THEN
 -- table exists

Alternatively, you could try catching the exception in your original
code and handling it.

 IF EXISTS (SELECT * FROM tmp_sources) THEN
    -- table or view exists
    EXCEPTION

Semyon

> How do I check if a table exists, eg. from a PLPGSQL function?
>    IF EXISTS (SELECT * FROM tmp_sources) THEN
>
> The function throws an error:
>
>    ERROR: relation "tmp_sources" does not exist
>

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

Предыдущее
От: "Leif B. Kristensen"
Дата:
Сообщение: Re: Check if table exists
Следующее
От: David Saracini
Дата:
Сообщение: Re: Check if table exists