Re: PostgreSQL 7.4.2 allows foreign key violation

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 17:08:11
Message-ID: 20040806100658.W13297@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 6 Aug 2004, Tom Lane wrote:

> 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...

It's not for overriding the triggers or rules, but instead checking that
the post action state is valid (by running the no action code which
makes sure that either another row now has the pk value or that there are
no longer any matching rows).

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Si Chen 2004-08-06 17:08:44 replication
Previous Message webb 2004-08-06 16:56:10 Re: Data version idea (please discuss)