Skip to content

Commit

Permalink
Fix #8290: 'Unique scan' is incorrectly reported in the explained pla…
Browse files Browse the repository at this point in the history
…n for unique index and IS NULL predicate
  • Loading branch information
dyemanov committed Oct 24, 2024
1 parent 5293f23 commit eb44a7e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/jrd/recsrc/RecordSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ void RecordSource::printInversion(thread_db* tdbb, const InversionNode* inversio
plan += "Bitmap" + printIndent(++level);

const index_desc& idx = retrieval->irb_desc;
const bool primaryIdx = (idx.idx_flags & idx_primary);
const bool uniqueIdx = (idx.idx_flags & idx_unique);
const USHORT segCount = idx.idx_count;

Expand All @@ -161,7 +162,13 @@ void RecordSource::printInversion(thread_db* tdbb, const InversionNode* inversio

const bool fullscan = (maxSegs == 0);
const bool list = (retrieval->irb_list != nullptr);
const bool unique = !list && uniqueIdx && equality && (minSegs == segCount);

bool unique = false;
if (!list && equality && minSegs == segCount)
{
unique = (retrieval->irb_generic & irb_ignore_null_value_key) ?
uniqueIdx : primaryIdx;
}

string bounds;
if (!unique && !fullscan)
Expand Down

0 comments on commit eb44a7e

Please sign in to comment.