Re: Contraints in postgresql ?
От | Stephan Szabo |
---|---|
Тема | Re: Contraints in postgresql ? |
Дата | |
Msg-id | Pine.BSF.4.21.0105141139250.16472-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | Contraints in postgresql ? (snpe <snpe@infosky.net>) |
Список | 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 по дате отправления: