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:42:43
Message-ID: 20040806103819.U14674@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:
> > On Fri, 6 Aug 2004, Tom Lane wrote:
> >> 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).
>
> Oh, I see. Seems an awfully expensive solution though :-(

Yeah. That's the major downside. We could potentially do it only if there
are any instead rules or before triggers on the action we want to do
(either delete or update). I'm not sure if/how expensive that would be to
determine. I think we could potentially check rules when the query is
planned (since presumably, those are the only rules that matter), but I
don't think that'd work for the triggers.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2004-08-06 17:55:51 Re: replication
Previous Message Tom Lane 2004-08-06 17:23:23 Re: PostgreSQL 7.4.2 allows foreign key violation