[YSQL] Disallow changing from read-write to read-only transaction if using serializable isolation
pkj415 opened this issue · 0 comments
pkj415 commented
Jira Link: DB-11930
Description
Pg allows changing a read-write transaction to read-only even after executing a few writes in a transaction block. This is the case in YB too, and is okay for RC/ RR isolation levels. But for serializable isolation level, we face the following issue:
create table test (k int primary key, v int);
yugabyte=# begin transaction isolation level serializable;
BEGIN
yugabyte=# insert into test values (4, 4);
INSERT 0 1
yugabyte=# set transaction_read_only=true;
SET
yugabyte=# select * from test;
ERROR: Attempt to change effective isolation from 2 to SNAPSHOT_ISOLATION in the middle of a transaction. Postgres-level isolation: SERIALIZABLE; read_only: 1.
yugabyte=#
Issue Type
kind/bug
Warning: Please confirm that this issue does not contain any sensitive information
- I confirm this issue does not contain any sensitive information.