Re: How to checking the existance of constraints for a table? - Mailing list pgsql-sql

From bricklen
Subject Re: How to checking the existance of constraints for a table?
Date
Msg-id AANLkTimh55F3Pin7Uogoijad3cX4=-tR8EX+RE6VQ3+f@mail.gmail.com
Whole thread Raw
In response to How to checking the existance of constraints for a table?  (creationw <mr.creation.register@gmail.com>)
List pgsql-sql
On Wed, Feb 2, 2011 at 12:40 PM, creationw
<mr.creation.register@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'


pgsql-sql by date:

Previous
From: Gerardo Herzig
Date:
Subject: Re: using of select (myfunction()).* is so slow
Next
From: Vibhor Kumar
Date:
Subject: Re: TABLE PARTITION