Re: Foreign key reference counting strategy? - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: Foreign key reference counting strategy?
Date
Msg-id 20061015010725.GA21149@winnie.fuhr.org
Whole thread Raw
In response to Re: Foreign key reference counting strategy?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Foreign key reference counting strategy?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
On Sat, Oct 14, 2006 at 08:20:10PM -0400, Tom Lane wrote:
> Michael Fuhr <mike@fuhr.org> writes:
> > Unless the inserters got there first.  I just tested both ways; if
> > the insert acquires the lock first then the delete fails, but if the
> > delete acquires the lock first then the insert fails.
> 
> Well, if the inserters get a lock on the PK row before the DELETE does,
> then of course.  I was just disputing the assertion that doing IF EXISTS
> in an after trigger would add a new way for the DELETE to fail.

My intent wasn't to assert that IF EXISTS adds a new way for the
DELETE to fail.  I was just pointing out that the test "if no
referencing rows exist then delete the referenced row" isn't
foolproof, viz., the DELETE can fail even though IF EXISTS said
there were no referencing rows.

-- 
Michael Fuhr


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Foreign key reference counting strategy?
Next
From: Tom Lane
Date:
Subject: Re: Foreign key reference counting strategy?