Re: pl sql to check if table of table_name exists
| От | Chris Travers |
|---|---|
| Тема | Re: pl sql to check if table of table_name exists |
| Дата | |
| Msg-id | 4230158C.5040907@travelamericas.com обсуждение |
| Ответ на | Re: pl sql to check if table of table_name exists (Shaun Clements <ShaunC@relyant.co.za>) |
| Список | pgsql-general |
Shaun Clements wrote: > Hi > > Hate to ask, but it isnt obvious to me from the documentation. > How do I perform a query in pgplsql, to check it a table exists of a > particular name. > Check the manual. There are two ways to d othis. You could query the data catalogs directly (something like count(*) from pg_class where relname = $1), but this is not preferred because you have the possibilities that the data catalogs will be changed in the future. The better way to do this is to query the information schema. I forget the table name but it may be something like (select count(*) from information_schema.tables where table_name = $1). the structure of the information schema is defined in the SQL standards and will be stable between versions. Best Wishes, Chris Travers Metatron Technology COnsulting > Thanks in advance > > Kind Regards, > Shaun Clements >
В списке pgsql-general по дате отправления: