Merge 'core/translate: fix rowid affinity' from Preston Thorpe

closes https://github.com/tursodatabase/turso/issues/3478

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3539
This commit is contained in:
Preston Thorpe
2025-10-02 16:37:59 -04:00
committed by GitHub
2 changed files with 9 additions and 0 deletions

View File

@@ -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)

View File

@@ -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}