Re: Changing constraints to deferrable - Mailing list pgsql-general

From Florian G. Pflug
Subject Re: Changing constraints to deferrable
Date
Msg-id 42417699.8030403@phlo.org
Whole thread Raw
In response to Changing constraints to deferrable  (Greg Stark <gsstark@mit.edu>)
Responses Re: Changing constraints to deferrable  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
Greg Stark wrote:
> I want all my foreign key constraints to be deferrable. They were all created
> with the default (not deferrable).
>
> Is it enough to just do
>
>   update pg_constraint set condeferrable = 't' where contype = 'f';

No - the constraints are actually enforced by triggers - Just just
normally don't see those triggers - but if you look into pg_triggers,
you'll find them. The have "tgisconstraint" set to true, so it should
be easy to find them.

Try an additional "update pg_trigger set isdeferrable=true where
pgisconstraint = true", and it should work..

I'm not etirely sure about the fieldnames - so better check them - e.g
"\d pg_catalog.pg_trigger" could help, when typed into psql ;-)

mfg, Florian Pflug


Attachment

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Extracting object source code from database to store in CVS...
Next
From: Lonni J Friedman
Date:
Subject: Re: postgres oracle emulation question