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 7886c9c commit a1167b4
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 @@ -203,6 +203,7 @@ void RecordSource::printInversion(thread_db* tdbb, const InversionNode* inversio
}

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 @@ -214,7 +215,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 a1167b4

Please sign in to comment.