Re: Avoiding deadlocks ...

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>,"Greg Stark" <gsstark(at)mit(dot)edu>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoiding deadlocks ...
Date: 2010-08-20 17:07:36
Message-ID: 4C6E70080200002500034996@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <gsstark(at)mit(dot)edu> wrote:
> Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>> update session where id = X;
>> update order where orderid = 5;
>> update order where orderid = 5;
>
> So i think this will already deadlock.
>
> A has a exclusive-lock on session<X> and is waiting on order<5>. B
> has an exclusive lock on order<5> and is waiting on a share-lock
> on session<x>

No, see Tom's explanation on the related "Deadlock bug" thread:

http://archives.postgresql.org/pgsql-hackers/2010-08/msg01464.php

>> update order where orderid = 5;
>> ... deadlock error.
>
> Do you actually get a prompt here to type this command?

Yes. The attachment at the start of the other thread makes it easy
to confirm:

http://archives.postgresql.org/pgsql-hackers/2010-08/msg01447.php

-Kevin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-08-20 17:27:05 Re: small smgrcreate cleanup patch
Previous Message Greg Stark 2010-08-20 16:57:47 Re: Avoiding deadlocks ...