Re: [HACKERS] postgresql transactons not fully isolated - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] postgresql transactons not fully isolated
Date
Msg-id 31202.1497981456@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] postgresql transactons not fully isolated  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> Michael Malis via:
> http://malisper.me/postgres-transactions-arent-fully-isolated/  has
> determined that postgresql transactions are not fully isolated even
> when using serializable isolationl level.

> If I prep a table, ints via:
> postgres=# create table ints (n int);
> CREATE TABLE
> postgres=# insert into ints values (1);
> INSERT 0 1
> postgres=# insert into ints values (2);
> INSERT 0 1

> and then run two concurrent in serializable isolation mode
> transactions like this:
> T1: BEGIN
> T1: UPDATE ints SET n = n + 1;
> T2: BEGIN
> T2: DELETE FROM ints where n = 2; -- blocks
> T1: COMMIT; -- T2 frees
> T2: SELECT * FROM ints;  -- both rows 2 and 3 visible
> T2: COMMIT:

Hm, I get

ERROR:  could not serialize access due to concurrent update

in T2 immediately after T1 commits.  What version are you testing?
Are you sure you selected serializable mode for both xacts?
(I think it would work like this even if only T2 is marked
serializable, but didn't test.)
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] PATCH: Don't downcase filepath/filename while loading libraries
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Missing comment for ResultRelInfo in execnodes.h