Re: PostgreSQL 7.4.2 allows foreign key violation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Markus Bertheau <twanger(at)bluetwanger(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL 7.4.2 allows foreign key violation
Date: 2004-08-06 16:25:43
Message-ID: 20097.1091809543@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> It also looks like before triggers returning NULL can break them.

Or a BEFORE trigger that overrides the attempted field update.

> I think we'd been worried about the added cost of doing the check when
> the average case doesn't have this problem but we should probably just
> eat it. In practice I think it's one line of code per action function
> (on update set default already does it).

Already does what? I see nothing in there that would override either
triggers or rules...

> Any opinions out there?

I seem to recall some discussions to the effect that having these
updates subject to rules/triggers is not necessarily bad. For example,
if you were using a rule or trigger to log all updates of table B
someplace else, you'd probably be annoyed to find the RI updates
bypassing your logging mechanism.

There's no perfect solution ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message webb 2004-08-06 16:56:10 Re: Data version idea (please discuss)
Previous Message ruben 2004-08-06 16:24:12 Re: Slow after VACUUM, fast after DROP-CREATE INDEX