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.



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to