From: bricklen <bricklen@gmail.com>
To: creationw <mr.creation.register@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to checking the existance of constraints for a table?
Date: Fri, 4 Feb 2011 08:38:40 -0800
Message-ID: <AANLkTimh55F3Pin7Uogoijad3cX4=-tR8EX+RE6VQ3+f@mail.gmail.com> (raw)
In-Reply-To: <1296679230744-3368417.post@n5.nabble.com>
References: <1296679230744-3368417.post@n5.nabble.com>
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'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: bricklen@gmail.com, mr.creation.register@gmail.com
Subject: Re: How to checking the existance of constraints for a table?
In-Reply-To: <AANLkTimh55F3Pin7Uogoijad3cX4=-tR8EX+RE6VQ3+f@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox