Re: Foreign key reference counting strategy?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL SQL List <pgsql-sql(at)postgresql(dot)org>, Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
Subject: Re: Foreign key reference counting strategy?
Date: 2006-10-15 01:07:26
Message-ID: 20061015010725.GA21149@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, Oct 14, 2006 at 08:20:10PM -0400, Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-10-15 02:10:13 Re: Foreign key reference counting strategy?
Previous Message Tom Lane 2006-10-15 00:20:10 Re: Foreign key reference counting strategy?