Re: BUG #10315: Transactions seem to be releasing locks early?

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: tim(dot)channell(at)gmail(dot)com, PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #10315: Transactions seem to be releasing locks early?
Date: 2014-05-14 12:06:07
Message-ID: CAB7nPqRa+Xwy-kMmeNEyYiEc1aCNRSLv=kmufkOcSCZBcE1pPQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, May 14, 2014 at 12:21 PM, Greg Stark <stark(at)mit(dot)edu> wrote:
> On Tue, May 13, 2014 at 9:51 PM, <tim(dot)channell(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message parthibanp2 2014-05-14 12:41:19 BUG #10316: Alter table rename fails if the "new name" starts with '_'
Previous Message Greg Stark 2014-05-14 03:21:55 Re: BUG #10315: Transactions seem to be releasing locks early?