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



---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to