Description:
Isolation Level: Repeatable Read.
The SELECT statement does not create a snapshot when the WHERE condition evaluates to false.
How to repeat:
/* init */ DROP TABLE IF EXISTS t;
/* init */ CREATE TABLE t (c1 CHAR(1));
/* init */ INSERT INTO t(c1) VALUES ('A');
/* t1 */ BEGIN;
/* t2 */ BEGIN;
/* t2 */ SELECT * FROM t WHERE TIMESTAMPDIFF(MONTH,'2025-11-6','2025-11-11');
/* t1 */ DELETE FROM t WHERE TRUE;
/* t2 */ INSERT INTO t(c1) VALUES ('B'); -- blocked
/* t1 */ COMMIT; -- t2 unblocked
/* t2 */ SELECT * FROM t ; -- [('B')]
/* t2 */ COMMIT;
The expectation is that transaction t2 will establish a snapshot at the first SELECT statement, so that the second SELECT statement can retrieve [('A'), ('B')]. However, in actual execution, the second SELECT statement in transaction t2 only retrieved [('B')] when the WHERE condition of the first SELECT statement was evaluated as false.
Description: Isolation Level: Repeatable Read. The SELECT statement does not create a snapshot when the WHERE condition evaluates to false. How to repeat: /* init */ DROP TABLE IF EXISTS t; /* init */ CREATE TABLE t (c1 CHAR(1)); /* init */ INSERT INTO t(c1) VALUES ('A'); /* t1 */ BEGIN; /* t2 */ BEGIN; /* t2 */ SELECT * FROM t WHERE TIMESTAMPDIFF(MONTH,'2025-11-6','2025-11-11'); /* t1 */ DELETE FROM t WHERE TRUE; /* t2 */ INSERT INTO t(c1) VALUES ('B'); -- blocked /* t1 */ COMMIT; -- t2 unblocked /* t2 */ SELECT * FROM t ; -- [('B')] /* t2 */ COMMIT; The expectation is that transaction t2 will establish a snapshot at the first SELECT statement, so that the second SELECT statement can retrieve [('A'), ('B')]. However, in actual execution, the second SELECT statement in transaction t2 only retrieved [('B')] when the WHERE condition of the first SELECT statement was evaluated as false.