From 1a2a383635ab9e3302594e59235d87c3c6eb7d96 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Tue, 29 Apr 2025 15:22:40 +0300 Subject: [PATCH] fix setting default value for primary key on UPDATE I noticed when updating a table with a primary key, it would sometimes set primary key column to null. A primary key can be nullified if it isn't a rowid alias, meaning it isn't a INTEGER PRIMAR KEY. --- core/translate/emitter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/translate/emitter.rs b/core/translate/emitter.rs index 77a3efdce..5ea2f9cfa 100644 --- a/core/translate/emitter.rs +++ b/core/translate/emitter.rs @@ -686,7 +686,7 @@ fn emit_update_insns( // don't emit null for pkey of virtual tables. they require first two args // before the 'record' to be explicitly non-null - if table_column.primary_key && !is_virtual { + if table_column.is_rowid_alias && !is_virtual { program.emit_null(target_reg, None); } else if is_virtual { program.emit_insn(Insn::VColumn {