Re: Modifying FK constraints - Mailing list pgsql-general

From Richard Huxton
Subject Re: Modifying FK constraints
Date
Msg-id 41924E6C.8050400@archonet.com
Whole thread Raw
In response to Modifying FK constraints  ("Oleg Lebedev" <oleglebedev@waterford.org>)
List pgsql-general
Oleg Lebedev wrote:
> Greetings.
>
> Is it possible to modify a foreign key constraint and force it to
> cascade on update? If there is no such SQL command, then is it possible
> to update some system tables to accomplish this?

BEGIN;
ALTER TABLE t1 DROP CONSTRAINT ...
ALTER TABLE t1 ADD CONSTRAINT ...
COMMIT;

Note that this will trigger a re-examination of all the values to check
the constraint is valid.

Also you may have to quote constraint names. If they are generated as $1
you will need to refer to them as "$1".

Full details in the "SQL Commands" chapter under "ALTER TABLE"
--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Oleg Lebedev"
Date:
Subject: Modifying FK constraints
Next
From: Mike Nolan
Date:
Subject: Re: Important Info on comp.databases.postgresql.general