BUG #11919: Serializable isolation issue: one session seeing writes from another session. - Mailing list pgsql-bugs

From gavin.panella@canonical.com
Subject BUG #11919: Serializable isolation issue: one session seeing writes from another session.
Date
Msg-id 20141108234236.2524.67434@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #11919: Serializable isolation issue: one session seeing writes from another session.
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      11919
Logged by:          Gavin Panella
Email address:      gavin.panella@canonical.com
PostgreSQL version: 9.3.5
Operating system:   Ubuntu 12.04
Description:

I think I might have found a bug in PostgreSQL 9.3.5 relating to
serializable isolation, where code running within a savepoint can see
data committed in a second session after the commencement of the first,
but that data then "disappears" when the savepoint is rolled-back.

Of course, my understanding may be the bug, but here's how to reproduce
the effect:

1. Open two psql sessions to the same database.

2. Create an example table:

     create table things (a int unique);

3. In the first session:

     begin isolation level serializable;
     insert into things (a) values (1);

   Don't commit yet.

4. In the second session:

     begin isolation level serializable;
     savepoint one;
     insert into things (a) values (1);

   This should hang.

5. In the first session:

     commit;

6. Go back to the second session. It will have failed with:

     ERROR:  duplicate key value violates unique constraint "things_a_key"
     DETAIL:  Key (a)=(1) already exists.

7. Continue in the second session:

     rollback to savepoint one;
     select * from things;

   You should see:

      a
     ---
     (0 rows)

pgsql-bugs by date:

Previous
From: gopigarg729@gmail.com
Date:
Subject: BUG #11926: warning
Next
From: John R Pierce
Date:
Subject: Re: BUG #11910: Database connection exhaustion