This answer claims that a transaction is useful for multiple read statements as well. Is the following test case faulty or does it require related tables to return consistent results?
In console #1 execute the following:
set transaction isolation level serializable;
begin transaction;
select * from TableA;
waitfor delay '00:00:15';
select * from TableB;
commit transaction;
In console #2, during that 15 second window, execute following:
set transaction isolation level serializable;
begin transaction;
insert into TableB(col) values('b');
commit transaction;
After 15 seconds has passed, console #1 returns with a row with 'b'
in it. Why? I thought console #1 would return no results or the transaction #1 would abort, because TableB
was modified.
I've tried SQL Server LocalDB 2017 on Windows and SQL Server 2019 RC1 on Linux. I ran my sql commands with DataGrip, but the original use case I had with Entity Framework 6.