mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-05 00:04:23 +01:00
return early if index is not found in op_idx_delete
This commit is contained in:
@@ -4378,7 +4378,7 @@ pub fn op_idx_delete(
|
||||
);
|
||||
match &state.op_idx_delete_state {
|
||||
Some(OpIdxDeleteState::Seeking(record)) => {
|
||||
{
|
||||
let found = {
|
||||
let mut cursor = state.get_cursor(*cursor_id);
|
||||
let cursor = cursor.as_btree_mut();
|
||||
let found = return_if_io!(
|
||||
@@ -4390,6 +4390,21 @@ pub fn op_idx_delete(
|
||||
cursor.root_page(),
|
||||
record
|
||||
);
|
||||
found
|
||||
};
|
||||
|
||||
if !found {
|
||||
// If P5 is not zero, then raise an SQLITE_CORRUPT_INDEX error if no matching index entry is found
|
||||
// Also, do not raise this (self-correcting and non-critical) error if in writable_schema mode.
|
||||
if *raise_error_if_no_matching_entry {
|
||||
return Err(LimboError::Corrupt(format!(
|
||||
"IdxDelete: no matching index entry found for record {:?}",
|
||||
record
|
||||
)));
|
||||
}
|
||||
state.pc += 1;
|
||||
state.op_idx_delete_state = None;
|
||||
return Ok(InsnFunctionStepResult::Step);
|
||||
}
|
||||
state.op_idx_delete_state = Some(OpIdxDeleteState::Verifying);
|
||||
}
|
||||
@@ -4399,9 +4414,7 @@ pub fn op_idx_delete(
|
||||
let cursor = cursor.as_btree_mut();
|
||||
return_if_io!(cursor.rowid())
|
||||
};
|
||||
|
||||
// If P5 is not zero, then raise an SQLITE_CORRUPT_INDEX error if no matching index entry is found
|
||||
// Also, do not raise this (self-correcting and non-critical) error if in writable_schema mode.
|
||||
|
||||
if rowid.is_none() && *raise_error_if_no_matching_entry {
|
||||
return Err(LimboError::Corrupt(format!(
|
||||
"IdxDelete: no matching index entry found for record {:?}",
|
||||
|
||||
Reference in New Issue
Block a user