Skip to content

Commit 866e6e1

Browse files
committed
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
1 parent eaba54c commit 866e6e1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/access/gin/ginget.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,9 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
741741
while (entry->matchResult == NULL ||
742742
(entry->matchResult->ntuples >= 0 &&
743743
entry->offset >= entry->matchResult->ntuples) ||
744-
entry->matchResult->blockno < advancePastBlk)
744+
entry->matchResult->blockno < advancePastBlk ||
745+
(ItemPointerIsLossyPage(&advancePast) &&
746+
entry->matchResult->blockno == advancePastBlk))
745747
{
746748
entry->matchResult = tbm_iterate(entry->matchIterator);
747749

0 commit comments

Comments
 (0)