Wouldn’t that be an error due to serialisation failure if in postgres if you enabled serialisable isolation?
If you didn’t, you could get anything, because unless I’m mistaken this is the typical example used to illustrate what goes wrong when you don’t have full serialisable isolation.
Why would repeatable read raise an error? I’m a little rusty but I thought it was only serialisable that could do, and that repeatable read simply ensured that the committed writes of transaction 2 would not be read in transaction 1, so it updating over the top of 2 is fine.
Wouldn’t that be an error due to serialisation failure if in postgres if you enabled serialisable isolation?
If you didn’t, you could get anything, because unless I’m mistaken this is the typical example used to illustrate what goes wrong when you don’t have full serialisable isolation.
I believe both
SERIALIZABLEandREPEATABLE READisolation levels would raise an error for this example.And I looked this up: Postgres won’t retry the transaction for you either. Though ultimately I think this a good default behavior.
Why would repeatable read raise an error? I’m a little rusty but I thought it was only serialisable that could do, and that repeatable read simply ensured that the committed writes of transaction 2 would not be read in transaction 1, so it updating over the top of 2 is fine.
I think you’re right. An
UPDATEwould fail, but not anINSERT.