Re: BUG #5505: Busted referential integrity with triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Tommy McDaniel" <tommstein(at)myway(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5505: Busted referential integrity with triggers
Date: 2010-06-15 03:41:03
Message-ID: 26428.1276573263@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Tommy McDaniel" <tommstein(at)myway(dot)com> writes:
> I can understand firing the triggers. But what's up with not checking that the foreign key constraint is met? If the user has to manually ensure that values maintain referential integrity, why have foreign keys at all? The whole point of foreign keys is to make the database ensure referential integrity is maintained instead of having to do it manually.

[ shrug... ] The database is doing its best. Do you really want us to
incur the extra overhead of checking that a trigger didn't screw things
up? Exactly how far should that go? For instance, maybe we have to
check that the trigger didn't queue a subsequent event that will make
the undesired change after we look? I can assure you that far more
people would complain about the useless overhead induced by rechecking
than will complain about the fact that they can write triggers that will
fire on RI updates.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message 中嶋 信二 2010-06-15 07:01:51 Re: BUG #5507: missing chunk number 0 for toast value XXXXX in pg_toast_XXXXX
Previous Message Tommy McDaniel 2010-06-15 01:12:41 Re: BUG #5505: Busted referential integrity with triggers