I have found these related issues/pull requests
No.
Description
Found while investigating why similar code (except that transaction had 2 DELETEs), actually deleted 0 rows but said it deleted 1 row.
Reproduction test:
- I expected it to return 0 rows affected, however it returned 2 rows affected.
- Commenting out anything (migration, creation of either table, insertion) fixes the issue.
Reproduction steps
Migration directory has single empty sql file: 000_init.sql.
sqlx = { version = "0.9", features = [ "runtime-tokio", "sqlite", "derive", "migrate", "uuid", "chrono" ] }
tokio = { version = "1.49.0", default-features = false, features = ["macros", "rt-multi-thread", "signal"] }
#[tokio::test]
async fn repro_empty_tx_2_rows_affected() -> sqlx::Result<()> {
let pool = SqlitePool::connect("sqlite::memory:").await?;
sqlx::migrate!("./repro_mig").run(&pool).await?;
// Tables.
let create_table = sqlx::query("CREATE TABLE my_table ( qqq TEXT );");
create_table.execute(&pool).await?;
let create_table = sqlx::query("CREATE TABLE other_table ( www TEXT );");
create_table.execute(&pool).await?;
// Insert.
sqlx::query("INSERT INTO my_table (qqq) VALUES ('temporary');")
.execute(&pool)
.await?;
// Bug.
let query_result = sqlx::query("BEGIN TRANSACTION; COMMIT;")
.execute(&pool)
.await?;
dbg!(&query_result);
// changes: 2,
// last_insert_rowid: 1,
assert_eq!(query_result.rows_affected(), 0);
// PANIC:
// assertion `left == right` failed
// left: 2
// right: 0
Ok(())
}
SQLx version
0.9
Enabled SQLx features
"runtime-tokio", "sqlite", "derive", "migrate", "uuid", "chrono"
Database server and version
SQLite
Operating system
Linux
Rust version
rustc 1.98.0-nightly (d595fce01 2026-06-02)
I have found these related issues/pull requests
No.
Description
Found while investigating why similar code (except that transaction had 2
DELETEs), actually deleted 0 rows but said it deleted 1 row.Reproduction test:
Reproduction steps
Migration directory has single empty sql file:
000_init.sql.SQLx version
0.9
Enabled SQLx features
"runtime-tokio", "sqlite", "derive", "migrate", "uuid", "chrono"
Database server and version
SQLite
Operating system
Linux
Rust version
rustc 1.98.0-nightly (d595fce01 2026-06-02)