[SQL] How to checking the existance of constraints for a table?

2011-02-03 Thread creationw
Hello, I have a sample table describe as follows, anyone knows how to checking the existence of a constraint? oviddb=# \d myTable Column | Type | Modifiers -+--+--- orderid | smallint | not null modelid | smallint | not null Indexes: "mytable_orderid_key" UN

[SQL] How to workaround DROP CONSTRAINT [ IF EXISTS ] in Postgres version 8.1?

2011-02-03 Thread creationw
Hello, I found that DROP CONSTRAINT [ IF EXISTS ] is available in Postgres 9.1 http://developer.postgresql.org/pgdocs/postgres/sql-altertable.html http://developer.postgresql.org/pgdocs/postgres/sql-altertable.html But it is not avaiable in Postgres 8.1 http://www.postgresql.org/docs/8.1/inter