Re: Contraints in postgresql ? - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Contraints in postgresql ?
Date
Msg-id Pine.BSF.4.21.0105141139250.16472-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Contraints in postgresql ?  (snpe <snpe@infosky.net>)
List pgsql-general
On Mon, 14 May 2001, snpe wrote:

> Hello,
>     I want next :
>
>     a) add constraint (primary and foreign) in existing table
>     b) temporary disable constraint and enable later
>
> Is it possible in Postgresql ?

Sort of...
You can add foreign key constraints using ALTER TABLE ADD CONSTRAINT,
and unique constraints with CREATE UNIQUE INDEX (primary keys are
effectively unique constraints where all the columns are not null
-- if you need to change the columns to not null that's a bit more
involved).  AFAIK, you can't really "disable" constraints, although
you can remove them (drop the index for unique.  you have to manually
drop the triggers created by the foreign key constraint) and re-add them.
However, if you've violated the constraint while it was gone, you
won't be able to re-add the constraint.



pgsql-general by date:

Previous
From: webb sprague
Date:
Subject: Wal logs continued...
Next
From: universe_made_of_atoms
Date:
Subject: Internet is putting lot of competition fire & heat under Microsoft SQL Server