From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Weird locking situation |
Date: | 2003-10-02 14:30:58 |
Message-ID: | 26968.1065105058@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> What is going on here? Surely getting a FOR UPDATE row lock should
> prevent another process getting an update lock?
I could not duplicate your results. I did
regression=# create table tab(id int , blah int);
CREATE TABLE
regression=# insert into tab values(1,1);
INSERT 320558 1
regression=# insert into tab values(1,2);
INSERT 320559 1
regression=# insert into tab values(2,3);
INSERT 320560 1
regression=# BEGIN;
BEGIN
regression=# SELECT * FROM tab WHERE id=1 FOR UPDATE;
id | blah
----+------
1 | 1
1 | 2
(2 rows)
<< in another window >>
regression=# UPDATE tab SET blah=1 WHERE id=1;
[waits]
<< back to first window >>
regression=# UPDATE tab SET blah=1 WHERE id=1;
UPDATE 2
regression=# end;
COMMIT
<< second window now reports >>
UPDATE 2
regression=#
The behavior you describe would certainly be a bug, but you'll have to
show a reproducible example to convince me it wasn't pilot error. One
idea that springs to mind is that maybe additional rows with id=1 were
inserted (by some other transaction) between the SELECT FOR UPDATE and
the UPDATE?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2003-10-02 14:47:40 | Re: Weird locking situation |
Previous Message | Tom Lane | 2003-10-02 14:16:30 | Re: minor view creation weirdness |