How to check if a table exists from functions.

Поиск
Список
Период
Сортировка
От mikael.kjellstrom@_no_spam_flygtaxi.se (Mikael Kjellström)
Тема How to check if a table exists from functions.
Дата
Msg-id Xns90C5A38888F9Fmikaelkjellstromnosp@206.221.255.129
обсуждение исходный текст
Ответы Re: How to check if a table exists from functions.  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
Maybe I am doing this the wrong way, but how do I check if a table exist?

This works from psql:

select relname
from pg_class
where relname = 'tablename'


But if I try to do the same from a PL/PGSQL stored procedure I get the 
following error message:

ERROR:  unexpected SELECT query in exec_stmt_execsql()

Isn't select's allowed from stored procedures?

Is there a more simple way to check if a table exists?


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

Предыдущее
От: Adriaan Joubert
Дата:
Сообщение: CAST issue/ecpg
Следующее
От: Alex Pilosov
Дата:
Сообщение: Re: Re: binary data