Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: chenhj <chjischj(at)163(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently
Date: 2015-10-26 19:17:06
Message-ID: CAMkU=1w4oe2Wqn9O4A4+rZG=Yo26FY6vOB7CeicWP1tUyCk7WA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Oct 26, 2015 at 10:47 AM, chenhj <chjischj(at)163(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message felipe 2015-10-26 20:48:47 BUG #13736: pg_dump should use E'' quotes
Previous Message colin.knox 2015-10-26 18:58:40 BUG #13735: pg_get_serial_sequence can be incorrect