The client has been using BEGIN DEFERRED as the transaction mode, which is almost never the most useful option:
For readonly transactions, it prevents them being executed on the replica
For read-write transactions, it causes random transaction failures if there is a concurrent write transaction on the server.
This PR introduces TransactionMode, which allows the user to select one of these options:
"write" does BEGIN IMMEDIATE, so that write transactions are serialized instead of aborted
"read" does BEGIN TRANSACTION READONLY, so that sqld can optimize it as read-only (this syntax is not yet recognized and treated as BEGIN DEFERRED by sqld)
The client has been using
BEGIN DEFERRED
as the transaction mode, which is almost never the most useful option:This PR introduces
TransactionMode
, which allows the user to select one of these options:"write"
doesBEGIN IMMEDIATE
, so that write transactions are serialized instead of aborted"read"
doesBEGIN TRANSACTION READONLY
, so that sqld can optimize it as read-only (this syntax is not yet recognized and treated asBEGIN DEFERRED
by sqld)"deferred"
explicitly opts intoBEGIN DEFERRED
.