Re: BUG #12330: ACID is broken for unique constraints

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, "nikita(dot)y(dot)volkov(at)mail(dot)ru" <nikita(dot)y(dot)volkov(at)mail(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #12330: ACID is broken for unique constraints
Date: 2014-12-29 15:31:46
Message-ID: CAHyXU0ye_RT0VsTyup=u-Y5xoE7TpN9k9LTJ4RegmSfgZpiwyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Dec 29, 2014 at 9:09 AM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:
> Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>> In other words, the current behavior is:
>> txn A,B begin
>> txn A inserts
>> txn B inserts over A, locks, waits
>> txn A commits. B aborts with duplicate key error
>
> What I'm proposing is that for serializable transactions B would
> get a serialization failure; otherwise B would get a duplicate key
> error. If the retry of B looks at something in the database to
> determine what it's primary key should be it will get a new value
> on the retry, since it will be starting after the commit of A. If
> it is using a literal key, not based on something changed by A, it
> will get a duplicate key error on the retry, since it will be
> starting after the commit of A.
>
> It will either succeed on retry or get an error for a different
> reason.

In that case: we don't agree. How come duplicate key errors would be
reported as serialization failures but not RI errors (for example,
inserting a record pointing to another record which a concurrent
transaction deleted)?

IMO, serialization errors are an implementation artifact and should
not mask well defined errors in SQL under any circumstances (or if
they must, those cases should absolutely be as narrow as possible).

merlin

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Stark 2014-12-29 15:44:57 Re: BUG #12330: ACID is broken for unique constraints
Previous Message Kevin Grittner 2014-12-29 15:09:09 Re: BUG #12330: ACID is broken for unique constraints

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2014-12-29 15:44:57 Re: BUG #12330: ACID is broken for unique constraints
Previous Message Kevin Grittner 2014-12-29 15:21:40 Re: Serialization exception : Who else was involved?