8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 15:23:03 +01:00

Fixed bug CORE-2586 : Non-NULL key in unique index could be not found when key is removed

This commit is contained in:
hvlad 2010-02-10 14:33:33 +00:00
parent cbc4514cb2
commit 0ba7ae6f1c

View File

@ -6502,12 +6502,18 @@ static contents remove_leaf_node(thread_db* tdbb, index_insertion* insertion, WI
btree_page* page = (btree_page*) window->win_buffer;
temporary_key* key = insertion->iib_key;
const UCHAR idx_flags = insertion->iib_descriptor->idx_flags;
const bool validateDuplicates =
((idx_flags & idx_unique) && !(key->key_flags & key_all_nulls)) ||
(idx_flags & idx_primary);
// Look for the first node with the value to be removed.
UCHAR* pointer;
USHORT prefix;
while (!(pointer = find_node_start_point(page, key, 0, &prefix,
insertion->iib_descriptor->idx_flags & idx_descending,
false, false, insertion->iib_number)))
false, false,
validateDuplicates ? NO_VALUE : insertion->iib_number )))
{
page = (btree_page*) CCH_HANDOFF(tdbb, window, page->btr_sibling, LCK_write, pag_index);
}