Posted on 2000-03-21
How do I check some conditions in PostgreSQL ?!
I couldn't find any "IF" or "CASE" commands in the help.
All I want is something like that:
IF 1=1 SELECT 'True' ELSE SELECT 'False'
and more advanced:
how do I check if a table exists?
I know it's stored in pg_class table and I can check the relname field, but how can I perform something after that ?
Let's say I want to drop the table if it exists...
In Microsoft SQL server I could write somthing like that:
IF EXISTS (SELECT the table name from a system tables)
DROP the table
How can it be done with PostgreSQL??