Re: converting FK's to "DEFERRABLE"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vivek Khera <khera(at)kcilink(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: converting FK's to "DEFERRABLE"
Date: 2004-09-17 19:27:10
Message-ID: 23996.1095449230@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Vivek Khera <khera(at)kcilink(dot)com> writes:
> Anyhow, is there some trickier way to make an FK deferrable?

Hack its pg_constraint.condeferrable and pg_constraint.condeferred
fields (the latter is the INITIALLY DEFERRED flag). You will also
need to find the triggers that implement the constraint and update
their pg_trigger.tgdeferrable and pg_trigger.tginitdeferred copies
of these values. Then start fresh backend sessions and I think
you're there.

AFAIK the most reliable way to find the triggers is to follow the
linking entries in pg_depend.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dann Corbit 2004-09-17 19:43:44 Re: Import an Excel table to a Postgresql one
Previous Message Vivek Khera 2004-09-17 19:04:08 converting FK's to "DEFERRABLE"