Re: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)
Date
Msg-id 22565.1171257028@sss.pgh.pa.us
Whole thread Raw
In response to Re: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)  (Marc Munro <marc@bloodnok.com>)
Responses Re: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)
List pgsql-hackers
Marc Munro <marc@bloodnok.com> writes:
> Consider a table C containing 2 child records C1 and C2, of parent P.
> If transaction T1 updates C1 and C2, the locking order of the the
> records will be C1, P, C2.  Another transaction, T2, that attempts to
> update only C2, will lock the records in order C2, P.

> The locks on C2 and P are taken in different orders by the two
> transactions, leading to the possibility of deadlock.

But the lock on P is shared, hence no deadlock.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Ooops ... seems we need a re-release pronto
Next
From: Tom Lane
Date:
Subject: Re: select from sequences