From 43aba0ee952a4eb743a69c6b0f9f1184df6e1c20 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 2 Oct 2025 14:29:53 -0400 Subject: [PATCH 1/2] Fix integer affinity for rowid expr type --- core/translate/expr.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/core/translate/expr.rs b/core/translate/expr.rs index b6207f9c7..e110523f3 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -3761,6 +3761,7 @@ pub fn get_expr_affinity( } Affinity::Blob } + ast::Expr::RowId { .. } => Affinity::Integer, ast::Expr::Cast { type_name, .. } => { if let Some(type_name) = type_name { crate::schema::affinity(&type_name.name) From 361bd70a268a7fceecce69415a915ff03461978b Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 2 Oct 2025 14:31:22 -0400 Subject: [PATCH 2/2] Add regression test for rowid affinity --- testing/affinity.test | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/testing/affinity.test b/testing/affinity.test index 9a08003cd..1c32d4e4d 100755 --- a/testing/affinity.test +++ b/testing/affinity.test @@ -12,3 +12,11 @@ do_execsql_test_on_specific_db {:memory:} affinity { {1|integer} {1a|text} } + +do_execsql_test_on_specific_db {:memory:} affinity-rowid { + create table t(a integer); + insert into t(rowid, a) values (1, 1); + select * from t where rowid = '1'; + select * from t where a = '1'; +} {1 +1}