Fix incorrect UNIQUE constraint failure behavior in UPDATE

UPDATE should skip over the UNIQUE constraint failure if the existing
row it found during the check has the same rowid as the row we are
currently updating
This commit is contained in:
Jussi Saurio
2025-08-21 16:25:35 +03:00
parent 9d44e97a7a
commit e224bb15a8

View File

@@ -1056,8 +1056,10 @@ fn emit_update_insns(
dest: idx_rowid_reg,
});
// Skip over the UNIQUE constraint failure if the existing row is the one that we are currently changing
let original_rowid_reg = beg;
program.emit_insn(Insn::Eq {
lhs: rowid_reg,
lhs: original_rowid_reg,
rhs: idx_rowid_reg,
target_pc: constraint_check,
flags: CmpInsFlags::default(), // TODO: not sure what type of comparison flag is needed