Re: referential Integrity and SHARE locks - Mailing list pgsql-hackers

From Marc Munro
Subject Re: referential Integrity and SHARE locks
Date
Msg-id 1170952454.21038.17.camel@bloodnok.com
Whole thread Raw
Responses Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)  (Marc Munro <marc@bloodnok.com>)
Re: referential Integrity and SHARE locks  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-hackers
Oops, forgot to include pgsql-hackers when I responded to this the first
time.
On Tue, 2007-06-02 at 20:53 -0500, Tom Lane wrote:
> Marc Munro <marc@bloodnok.com> writes:
> > The RI triggers currently fire when a record is updated.  Under my
> > proposal they would fire in the same way but before the record is
locked
> > rather than after.  Or am I missing your point?
>
> IOW, some other transaction could update or delete the tuple
meanwhile?
> Doesn't seem very promising.
>

That other transaction, T1, would have run the same RI triggers and so
would have the same parent records locked.  The blocked transaction, T2,
once T1 has committed, would fail.

I don't see this as being much different from the current case, where T1
locks and deletes or updates a row, and T2 then tries to manipulate the
same row.  In both cases, locks manage the race for the row, and MVCC
ensures that T2 fails.

__
Marc


pgsql-hackers by date:

Previous
From: Gavin Sherry
Date:
Subject: Re: Bitmap index thoughts
Next
From: Marc Munro
Date:
Subject: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)