Search Postgresql Archives

9.1/9.2 SERIALIZABLE: expected serialization failure between INSERT and SELECT not encountered

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all

In this SO question:

http://dba.stackexchange.com/questions/26905/how-do-i-implement-insert-if-not-found-for-transactions-at-serializable-isolatio/26909#26909

the author is running a series of queries that I'd expect to abort on commit with a serialisation failure. No such failure occurs, and I'm wondering why.

SETUP

create table artist (id serial primary key, name text);



SESSION 1                                   SESSION 2

BEGIN ISOLATION LEVEL SERIALIZABLE;

                                            BEGIN ISOLATION LEVEL SERIALIZABLE;

                                            SELECT id FROM artist
                                            WHERE name = 'Bob';

INSERT INTO artist (name)
VALUES ('Bob')

                                            INSERT INTO artist (name)
                                            VALUES ('Bob')

COMMIT;                                     COMMIT;


I'd expect one of these two to abort with a serialization failure and I'm not sure I understand why they don't in 9.1/9.2's new serializable mode. Shouldn't the SELECT for "Bob" cause the insertion of "Bob" in the other transaction to violate serializability?

--
Craig Ringer


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux