Re: referential integrity without trigger

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Presber <aljoscha(at)weisshuhn(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: referential integrity without trigger
Date: 2006-02-09 22:53:29
Message-ID: 5574.1139525609@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alexander Presber <aljoscha(at)weisshuhn(dot)de> writes:
> Is there a clever, general scheme to "recheck" and enforce foreign
> key contraints, after the responsible triggers have been disabled and
> reenabled?

Drop the constraint (keep your fingers off the trigger, thank you ;-)).
Modify the master table. Re-create the constraint before committing.
ALTER TABLE ADD FOREIGN KEY does this about as fast as any ad-hoc idea
you might come up with.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gonzalo Villegas 2006-02-09 22:57:03 Insert more than one t-uple in a single sql
Previous Message Chandra Sekhar Surapaneni 2006-02-09 21:44:15 Re: Update table with data from another table