From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | snpe <snpe(at)infosky(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Contraints in postgresql ? |
Date: | 2001-05-14 18:42:45 |
Message-ID: | Pine.BSF.4.21.0105141139250.16472-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Thalis A. Kalfigopoulos | 2001-05-14 19:21:27 | Re: Re: |
Previous Message | Simon Crute | 2001-05-14 17:59:38 | Re: problems with timestamp fields |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Swan | 2001-05-14 19:08:42 | Re: 7.2 items |
Previous Message | Hannu Krosing | 2001-05-14 18:34:12 | Re: pg_index.indislossy |