From: | bricklen <bricklen(at)gmail(dot)com> |
---|---|
To: | creationw <mr(dot)creation(dot)register(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: How to checking the existance of constraints for a table? |
Date: | 2011-02-04 16:38:40 |
Message-ID: | AANLkTimh55F3Pin7Uogoijad3cX4=-tR8EX+RE6VQ3+f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, Feb 2, 2011 at 12:40 PM, creationw
<mr(dot)creation(dot)register(at)gmail(dot)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'
From | Date | Subject | |
---|---|---|---|
Next Message | Sarbu Anca | 2011-02-05 22:26:54 | PosgreSQL - TSQL2 question |
Previous Message | Gerardo Herzig | 2011-02-04 12:05:11 | Re: using of select (myfunction()).* is so slow |