On Wed, Feb 2, 2011 at 12:40 PM, creationw <mr.creation.regis...@gmail.com> wrote: > > 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" UNIQUE, btree (orderid) > > For example, how to know that myTable has a constraint with name > "mytable_orderid_key"?
You could try checking the information_schema.table_constraints view. Eg. select * from information_schema.table_constraints where table_name='myTable' -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql