Re: How do concurrent inserts work? - Mailing list pgsql-novice

From Tom Lane
Subject Re: How do concurrent inserts work?
Date
Msg-id 28189.1419702737@sss.pgh.pa.us
Whole thread Raw
In response to How do concurrent inserts work?  (Yaroslav <ladayaroslav@yandex.ru>)
Responses Re: How do concurrent inserts work?  (Yaroslav <ladayaroslav@yandex.ru>)
List pgsql-novice
Yaroslav <ladayaroslav@yandex.ru> writes:
> http://postgresql.nabble.com/Re-BUG-12330-ACID-is-broken-for-unique-constraints-td5832085.html

> I've come to conclusion that I don't understand PostgreSQL transaction
> isolation. :(

In your example, you've already committed the other insertion of "2",
right?  So the serializable transaction *must* fail to insert "2".
The current coding chooses to give you a "duplicate key" error on
the grounds that that's more helpful than a generic "serialization
failure" error.  The debate around bug #12330 is about whether that
is the best choice of error code ... but one way or the other, you're
going to get an error.  On the other hand, the SELECT step isn't going
to show you the "2", because it's in the future so far as the
transaction's snapshot is concerned.

            regards, tom lane


pgsql-novice by date:

Previous
From: David G Johnston
Date:
Subject: Re: How do concurrent inserts work?
Next
From: Yaroslav
Date:
Subject: Re: How do concurrent inserts work?