If you type BEGIN IMMEDIATE; into turso shell, it times out on the server after 5 seconds, but this fact is not reported to the user in any way. So if one does the following:
BEGIN IMMEDIATE
(wait 6 seconds)
INSERT INTO t VALUES (42)
INSERT INTO t VALUES (43)
COMMIT
... they'll get an error on COMMIT saying that "no transaction is active", but what's worse, (3.) and (4.) look like they're part of a single atomic operation, and they are not. The transaction started in (1.) timed out without any notification, so inserts from (3.) and (4.) are sent outside of this transaction's scope. We should instead be clear that BEGIN IMMEDIATE returns an error when a transaction times out. We should track that we're inside a transaction, and if a subsequent query gets an error saying that a session expired, we need to error out.
If you type
BEGIN IMMEDIATE;
intoturso shell
, it times out on the server after 5 seconds, but this fact is not reported to the user in any way. So if one does the following:BEGIN IMMEDIATE
INSERT INTO t VALUES (42)
INSERT INTO t VALUES (43)
COMMIT
... they'll get an error on
COMMIT
saying that "no transaction is active", but what's worse, (3.) and (4.) look like they're part of a single atomic operation, and they are not. The transaction started in (1.) timed out without any notification, so inserts from (3.) and (4.) are sent outside of this transaction's scope. We should instead be clear thatBEGIN IMMEDIATE
returns an error when a transaction times out. We should track that we're inside a transaction, and if a subsequent query gets an error saying that a session expired, we need to error out.