From f469113d9fba42006a7fd30cd3be738354060426 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Tue, 9 Sep 2025 11:32:04 +0300 Subject: [PATCH] Don't crash if DELETE uses index --- core/translate/display.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/core/translate/display.rs b/core/translate/display.rs index 384cf7f54..8a83f9a76 100644 --- a/core/translate/display.rs +++ b/core/translate/display.rs @@ -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(())