Weird locking situation

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Weird locking situation
Date: 2003-10-02 08:29:14
Message-ID: 3F7BE1DA.9060600@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi guys,

I'm just trying to understand this situation:

Session 1
---------
BEGIN;
SELECT * FROM tab WHERE id=1 FOR UPDATE;

Session 2
---------
UPDATE tab SET blah=1 WHERE id=1;
<waits>

Session 1
---------
UPDATE tab SET blah=1 WHERE id=1;
ERROR: deadlock detected

Session 2
---------
...update has gone through.

What is going on here? Surely getting a FOR UPDATE row lock should
prevent another process getting an update lock?

Chris

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Elphick 2003-10-02 09:33:05 Re: minor view creation weirdness
Previous Message Karel Zak 2003-10-02 08:19:30 Re: PREPARE/EXECUTE across backends?