Re: check table existence...

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: check table existence...
Дата
Msg-id 20070115123433.GA28738@a-kretschmer.de
обсуждение исходный текст
Ответ на check table existence...  ("Moritz Bayer" <moritz.bayer@googlemail.com>)
Ответы Re: check table existence...  (Alban Hertroys <alban@magproductions.nl>)
Re: check table existence...  ("Moritz Bayer" <moritz.bayer@googlemail.com>)
Список pgsql-general
am  Mon, dem 15.01.2007, um 13:18:11 +0100 mailte Moritz Bayer folgendes:
> Dear list,
>
> I would like to create a function which gets a tablename and checks if the
> specific table exists.The return value should be a bool.
> Now I'm wondering how to do this the best way.
>
> Any suggestions?

You can ask pg_tables:

select count(1) from pg_tables where tablename = 'foo' and schemaname = 'public';


This ask for a table called 'foo' in the schema 'public'.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

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

Предыдущее
От: "Moritz Bayer"
Дата:
Сообщение: check table existence...
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: check table existence...