Re: Weird locking situation
От | Tom Lane |
---|---|
Тема | Re: Weird locking situation |
Дата | |
Msg-id | 26968.1065105058@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Weird locking situation (Christopher Kings-Lynne <chriskl@familyhealth.com.au>) |
Ответы |
Re: Weird locking situation
Re: Weird locking situation |
Список | pgsql-hackers |
Christopher Kings-Lynne <chriskl@familyhealth.com.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
В списке pgsql-hackers по дате отправления: