Commit 866e6e1d authored by Heikki Linnakangas's avatar Heikki Linnakangas

Fix bug in lossy-page handling in GIN

When returning rows from a bitmap, as done with partial match queries, we
would get stuck in an infinite loop if the bitmap contained a lossy page
reference.

This bug is new in master, it was introduced by the patch to allow skipping
items refuted by other entries in GIN scans.

Report and fix by Alexander Korotkov
parent eaba54c2
...@@ -741,7 +741,9 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, ...@@ -741,7 +741,9 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
while (entry->matchResult == NULL || while (entry->matchResult == NULL ||
(entry->matchResult->ntuples >= 0 && (entry->matchResult->ntuples >= 0 &&
entry->offset >= entry->matchResult->ntuples) || entry->offset >= entry->matchResult->ntuples) ||
entry->matchResult->blockno < advancePastBlk) entry->matchResult->blockno < advancePastBlk ||
(ItemPointerIsLossyPage(&advancePast) &&
entry->matchResult->blockno == advancePastBlk))
{ {
entry->matchResult = tbm_iterate(entry->matchIterator); entry->matchResult = tbm_iterate(entry->matchIterator);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment