Re: BUG #10315: Transactions seem to be releasing locks early? - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #10315: Transactions seem to be releasing locks early?
Date
Msg-id CAB7nPqRa+Xwy-kMmeNEyYiEc1aCNRSLv=kmufkOcSCZBcE1pPQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #10315: Transactions seem to be releasing locks early?  (Greg Stark <stark@mit.edu>)
Responses Re: BUG #10315: Transactions seem to be releasing locks early?  (Tim Channell <tim.channell@gmail.com>)
List pgsql-bugs
On Wed, May 14, 2014 at 12:21 PM, Greg Stark <stark@mit.edu> wrote:
> On Tue, May 13, 2014 at 9:51 PM,  <tim.channell@gmail.com> wrote:
>> 7. Back in the second transaction, our DELETE has executed because the lock
>> was released. It would be expected to show "DELETE 1", because the first
>> transaction re-inserted the deleted record. But, it shows DELETE 0.
>
> It can't see the second row because it was inserted after the delete
> query started.
>
> I think in SERIALIZABLE mode it would be flagged as a serialization
> failure but I'm not sure.
Yep because session 1 has done a concurrent update on the row session
2 is trying to delete. You would actually get something like that:
=# DELETE FROM test WHERE id = 2;
ERROR:  40001: could not serialize access due to concurrent update
LOCATION:  ExecDelete, nodeModifyTable.c:447
--
Michael

pgsql-bugs by date:

Previous
From: Greg Stark
Date:
Subject: Re: BUG #10315: Transactions seem to be releasing locks early?
Next
From: parthibanp2@gmail.com
Date:
Subject: BUG #10316: Alter table rename fails if the "new name" starts with '_'