Re: Avoiding deadlocks ...

From: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Avoiding deadlocks ...
Date: 2010-08-20 09:09:40
Message-ID: 4C6E4654.1010100@cs.helsinki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2010-08-20 11:39 AM +0300, Josh Berkus wrote:
> On 8/19/10 3:51 PM, Josh Berkus wrote:
>> Two sessions, in transaction:
>>
>> Process A Process B
>>
>> update session where id = X;
>> update order where orderid = 5;
>> update order where orderid = 5;
>> update order where orderid = 5;
>> ... deadlock error.
>
> Johto on IRC pointed out I left something out of the above: "session" is
> referenced in an FK by "orders", and session = X is related to orderid = 5.

Right, that would result in a deadlock. I think truly serializable
transactions still need to SELECT FOR SHARE here for foreign keys to
work, no?

Regards,
Marko Tiikkaja

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2010-08-20 09:21:18 Re: Fw: patch for pg_ctl.c to add windows service start-type
Previous Message Thom Brown 2010-08-20 08:50:20 Re: Avoiding deadlocks ...