referential integrity without trigger

From: Alexander Presber <aljoscha(at)weisshuhn(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: referential integrity without trigger
Date: 2006-02-09 08:57:40
Message-ID: 302F3CB4-1087-4AAD-A23A-C9AE1C3FDFD9@weisshuhn.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello everybody,

Assuming I want to empty and refill table A (with roughly the same
content, preferrably in one transaction) and don't want to completely
empty a dependent table B but still keep referential integrity after
the commit.

Without disabling A's on-delete-trigger B will be be emptied on
commit, even when I inserted exactly the same data into A that I
deleted an instant before. That is because the trigger gets called on
commit, no matter if the deleted rows have "reappeared".

If I disable the trigger, My referential integrity is most likely
corrupted.
Is there a clever, general scheme to "recheck" and enforce foreign
key contraints, after the responsible triggers have been disabled and
reenabled?

I hope this makes sense to you.

Alexander Presber

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-02-09 09:14:44 Re: loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
Previous Message Tom Lane 2006-02-09 07:19:19 Re: r trim of characters other than space