Marc Munro <marc(at)bloodnok(dot)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