Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently - Mailing list pgsql-bugs

From Jeff Janes
Subject Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently
Date
Msg-id CAMkU=1w4oe2Wqn9O4A4+rZG=Yo26FY6vOB7CeicWP1tUyCk7WA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently  (chenhj <chjischj@163.com>)
List pgsql-bugs
On Mon, Oct 26, 2015 at 10:47 AM, chenhj <chjischj@163.com> wrote:

> >Can you reproduce the problem under a higher transaction isolation level?
> >
> >Cheers,
> >
> >Jeff
>
> Under higher transaction isolation level(REPEATABLE READ or SERIALIZABLE),
> only one transaction's UPDATE could be executed, the second transaction's
> UPDATE will be blocked util the first transaction committed and then
> throw "could not serialize access due to concurrent update" error.
>

Yes, this is the correct  behavior.  It can't serialize, so it gives an
error which the user can then decide how to handle (simply retry the same
transaction would probably be best, in this case).

It would be nice if pgbench had a mode where it would do the retry for you
upon retryable errors, but right now it doesn't.

Cheers,

Jeff

pgsql-bugs by date:

Previous
From: chenhj
Date:
Subject: Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently
Next
From: felipe@felipegasper.com
Date:
Subject: BUG #13736: pg_dump should use E'' quotes