From: Greg Stark <gsstark@mit.edu>
To: Bruno Wolff III <bruno@wolff.to>
Cc: Michael Fuhr <mike@fuhr.org>
Cc: frank@joerdens.de
Cc: pgsql-sql@postgresql.org
Subject: Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE
Date: 30 Mar 2005 17:51:16 -0500
Message-ID: <87sm2cwxwb.fsf@stark.xeocode.com> (raw)
In-Reply-To: <20050330190255.GA19669@wolff.to>
References: <20050330090732.GA10376@mail.archi-me-des.de>
<op.sof2u5gmth1vuj@localhost>
<20050330103311.GB10376@mail.archi-me-des.de>
<20050330175232.GB17708@wolff.to>
<20050330175242.GA36241@winnie.fuhr.org>
<20050330190255.GA19669@wolff.to>
Bruno Wolff III <bruno@wolff.to> writes:
> It does look like you can only ADD and DROP constraints, not directly
> alter or replace them. So making a reference deferable is go to require
> a DROP and ADD which will need to recheck the constraint.
I asked the same question a few days ago on pgsql-general.
In short, if you want to skip the rechecking you have to update system tables
directly and you have to do two of them.
The updates you want would look something like these. But these would do *all*
your constraints, make sure to get only the ones you really want to change:
update pg_constraint set condeferrable = 't' where contype = 'f'
update pg_trigger set tgdeferrable=true where tgisconstraint = true
I think an ALTER CONSTRAINT to change these settings as well as the
ON {UPDATE,DELETE} behaviour would be neat.
--
greg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gsstark@mit.edu, bruno@wolff.to, mike@fuhr.org, frank@joerdens.de
Subject: Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE
In-Reply-To: <87sm2cwxwb.fsf@stark.xeocode.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox