Don't crash if DELETE uses index

This commit is contained in:
Jussi Saurio
2025-09-09 11:32:04 +03:00
parent e0ca0cf8af
commit f469113d9f

View File

@@ -143,9 +143,24 @@ impl Display for DeletePlan {
writeln!(f, "{indent}DELETE FROM {table_name}")?;
}
Operation::Search { .. } => {
panic!("DELETE plans should not contain search operations");
}
Operation::Search(search) => match search {
Search::RowidEq { .. } | Search::Seek { index: None, .. } => {
writeln!(
f,
"{}SEARCH {} USING INTEGER PRIMARY KEY (rowid=?)",
indent, reference.identifier
)?;
}
Search::Seek {
index: Some(index), ..
} => {
writeln!(
f,
"{}SEARCH {} USING INDEX {}",
indent, reference.identifier, index.name
)?;
}
},
}
}
Ok(())