Weird locking situation - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Weird locking situation
Date
Msg-id 3F7BE1DA.9060600@familyhealth.com.au
Whole thread Raw
Responses Re: Weird locking situation
List 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




pgsql-hackers by date:

Previous
From: Karel Zak
Date:
Subject: Re: PREPARE/EXECUTE across backends?
Next
From: Oliver Elphick
Date:
Subject: Re: minor view creation weirdness