diff --git a/core/translate/emitter.rs b/core/translate/emitter.rs index 0068f7c34..7a9ec625e 100644 --- a/core/translate/emitter.rs +++ b/core/translate/emitter.rs @@ -1067,6 +1067,9 @@ fn emit_update_insns( }); } + // If we are updating the rowid, we cannot rely on overwrite on the + // Insert instruction to update the cell. We need to first delete the current cell + // and later insert the updated record if has_user_provided_rowid { program.emit_insn(Insn::Delete { cursor_id }); } diff --git a/core/translate/update.rs b/core/translate/update.rs index 2f95b49d6..95ec4484f 100644 --- a/core/translate/update.rs +++ b/core/translate/update.rs @@ -293,6 +293,7 @@ pub fn prepare_update_plan( .joined_tables() .first() .unwrap(); + // We do not need to emit an ephemeral plan if we are not going to loop over the table values if matches!(table.op, Operation::Search(Search::RowidEq { .. })) { (None, vec![]) } else {