Skip to content

Commit a1167b4

Browse files
committed
Fix #8290: 'Unique scan' is incorrectly reported in the explained plan for unique index and IS NULL predicate
1 parent 7886c9c commit a1167b4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/jrd/recsrc/RecordSource.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ void RecordSource::printInversion(thread_db* tdbb, const InversionNode* inversio
203203
}
204204

205205
const index_desc& idx = retrieval->irb_desc;
206+
const bool primaryIdx = (idx.idx_flags & idx_primary);
206207
const bool uniqueIdx = (idx.idx_flags & idx_unique);
207208
const USHORT segCount = idx.idx_count;
208209

@@ -214,7 +215,13 @@ void RecordSource::printInversion(thread_db* tdbb, const InversionNode* inversio
214215

215216
const bool fullscan = (maxSegs == 0);
216217
const bool list = (retrieval->irb_list != nullptr);
217-
const bool unique = !list && uniqueIdx && equality && (minSegs == segCount);
218+
219+
bool unique = false;
220+
if (!list && equality && minSegs == segCount)
221+
{
222+
unique = (retrieval->irb_generic & irb_ignore_null_value_key) ?
223+
uniqueIdx : primaryIdx;
224+
}
218225

219226
string bounds;
220227
if (!unique && !fullscan)

0 commit comments

Comments
 (0)