Re: check table existence...

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: check table existence...
Дата
Msg-id 45AB7591.5050908@magproductions.nl
обсуждение исходный текст
Ответ на Re: check table existence...  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Ответы Re: check table existence...  ("Shoaib Mir" <shoaibmir@gmail.com>)
Список pgsql-general
A. Kretschmer wrote:
> 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'.

If you do (something like) that in pl/pgsql, you could RETURN FOUND
after performing that query.

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: check table existence...
Следующее
От: "Jan van der Weijde"
Дата:
Сообщение: Re: Performance with very large tables