Michael Fuhr <[EMAIL PROTECTED]> writes: > On Sat, Oct 14, 2006 at 07:58:06PM -0400, Tom Lane wrote: >> No, I don't think so, because the DELETE will already be holding >> exclusive lock on the doomed PK row, which any would-be inserters of >> matching FK rows will be blocked on. AFAICS the DELETE should go >> through and then the inserters will fail.
> 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. At that point, any uncommitted inserts must be blocked waiting for the delete. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq