Re: Does this table exist?

Поиск
Список
Период
Сортировка
От Warren Vanichuk
Тема Re: Does this table exist?
Дата
Msg-id Pine.LNX.4.21.0011021304240.15920-100000@urd.street-light.com
обсуждение исходный текст
Ответ на Does this table exist?  (Alvaro Herrera <alvherre@protecne.cl>)
Список pgsql-general
> Now, the question is: Is there a way to know if a given table exist?
> Besides doing a direct query to it, of course, as I think that would be
> too much of a dinamite-fishing way of doing it.

I believe you want the pg_tables table (view?)  A quick and dirty way would
be :

select tablename from pg_tables where tablename = 'tablecheck' and if you
get a row, the table exists.  Alternatively you could select tablename from
pg_tables where tableowner != 'postgres' and get a list of all tables in the
current database that don't belong to the postgresql system.

Though I'm also fairly new to PostgreSQL, so this could also be 'dynamite
fishing'  ;)

Sincerely, Warren
-----
Warren Vanichuk,  Systems Engineer,
Street Light Productions Ltd.


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Does this table exist?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: CREATE FUNCTION problem