core icon indicating copy to clipboard operation
core copied to clipboard

V5: Repeatable read isolation doesn't work as expected

Open mkevison opened this issue 2 years ago • 0 comments

Package version

5.9.0

Describe the bug

I'm running some tests with isolation in Postgres

I create a transaction with the isolation type repeatable read

const firstTransaction = await Database.connection(connection).transaction({
       isolationLevel: 'repeatable read',
})

After that, I perform a query using the newly created transaction.

Through a second transaction, before committing the firstTransaction, I read, update and commit the data read by the firstTransaction

After changes using the second transaction I update the same data again using the firstTransaction

What is expected is that the firstTransaction commit gives an error and that is not what is happening, the commit passes normally

I simulated this through two Postgres terminals and it worked as expected, the firstTransaction after reading and changing the data does not accept the commit if this data is changed by another transaction before its commit

Note: I am correctly using firstTransaction when reading and changing data

Reproduction repo

https://github.com/mkevison/repeatable-read

mkevison avatar Feb 10 '24 16:02 mkevison