BUG #17018: Two versions of the same row of records are returned in one query

Started by PG Bug reporting formalmost 5 years ago1 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 17018
Logged by: Keqiang Li
Email address: 52194501011@stu.ecnu.edu.cn
PostgreSQL version: 9.6.21
Operating system: CentosLinux release 7.4.1708 ( Core)
Description:

Schema and Initial data:
Create Table t(a int primary key, b int);
Insert into t values(1,2);
Insert into t values(2,3);

Operation:
There are two sessions executing at the same time.

[Time0, SessonA]

Begin;
set transaction isolation level repeatable read;
Select * from t where a=1;

[Time1, SessonB]

Begin;
set transaction isolation level read committed;
Delete from t where a=2;
Commit;

[Time2, SessonA]

Insert into t values(2,4);
Select * from t where a=2;

Here, we expect PostgreSQL Server to return a row:
2 4

However, it returns two rows:
2 4
2 3