Re: Unique constraint error instead of serialization_failure

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Benny Kramek <benny(at)medflyt(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Unique constraint error instead of serialization_failure
Date: 2020-05-21 01:46:24
Message-ID: CA+hUKG+YrObyris4OuuZyXPqWdmwge32-VYbnMr4Zvi4rUnxHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, May 21, 2020 at 9:24 AM Benny Kramek <benny(at)medflyt(dot)com> wrote:
> Tested PostgreSQL versions: 10.7, 12.2
>
> Hello, I have found an example where I expect to get a serialization failure
> error, but instead receive a unique constraint error. My understanding is that
> this is not supposed to happen starting with PostgreSQL version 9.6 because of
> this patch:
>
> <https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=fcff8a575198478023ada8a48e13b50f70054766>

Agreed. Thanks for the test case. I hope to look into this in a few
days, but as a kind of Post-It note to remind me, here is your test
case in the form of an isolation test. Clearly it hasn't quite formed
the dangerous structure at the point the UCV is raised. Perhaps where
that commit added the extra CheckForSerializableConflictIn() call, it
also needs to ask the table AM to do the same sort of thing for its
tuple? Not sure without doing some digging. That'd be similar to
(but not the same as) the AM-assisted SSI checks I contemplated to
make this work for exclude constraints too.

https://www.postgresql.org/message-id/flat/CAMTXbE-sq9JoihvG-ccC70jpjMr%2BDWmnYUj%2BVdnFRFSRuaaLZQ%40mail.gmail.com

Attachment Content-Type Size
0001-Add-new-SERIALIZABLE-vs-UCV-test.patch text/x-patch 3.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2020-05-21 01:56:47 Re: BUG #16454: Mixed isolation levels inside transactions
Previous Message PG Bug reporting form 2020-05-21 00:52:29 BUG #16454: Mixed isolation levels inside transactions