From 993c9d34b480f64346b7b7f16c36c7e42f3e46b3 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Sun, 9 Nov 2025 11:07:29 -0500 Subject: [PATCH] Rollback vtab txns when when err code is present in Halt --- core/vdbe/execute.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/vdbe/execute.rs b/core/vdbe/execute.rs index a62314512..f579c1389 100644 --- a/core/vdbe/execute.rs +++ b/core/vdbe/execute.rs @@ -2254,6 +2254,7 @@ pub fn halt( if err_code > 0 { // Any non-FK constraint violation causes the statement subtransaction to roll back. state.end_statement(&program.connection, pager, EndStatement::RollbackSavepoint)?; + vtab_rollback_all(&program.connection, state)?; } match err_code { 0 => {} @@ -2327,6 +2328,7 @@ pub fn halt( } } +/// Call xCommit on all virtual tables that participated in the current transaction. fn vtab_commit_all(conn: &Connection, state: &mut ProgramState) -> crate::Result<()> { let mut set = conn.vtab_txn_states.write(); if set.is_empty() { @@ -2343,6 +2345,7 @@ fn vtab_commit_all(conn: &Connection, state: &mut ProgramState) -> crate::Result Ok(()) } +/// Rollback all virtual tables that are part of the current transaction. fn vtab_rollback_all(conn: &Connection, state: &mut ProgramState) -> crate::Result<()> { let mut set = conn.vtab_txn_states.write(); if set.is_empty() {