aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-05-10 23:24:23 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-05-10 23:28:26 +0300
commit866e6e1d04d4ae9615bd1899a757dae0191e9c77 (patch)
tree55c6d47028e5d832ebf04ff39e224cceed1faff0
parenteaba54c20c5ab2cb6aaffa574444fd4990dfe2c7 (diff)
downloadpostgresql-866e6e1d04d4ae9615bd1899a757dae0191e9c77.tar.gz
postgresql-866e6e1d04d4ae9615bd1899a757dae0191e9c77.zip
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
-rw-r--r--src/backend/access/gin/ginget.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index 271f09901b9..144ed504dc2 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -741,7 +741,9 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
while (entry->matchResult == NULL ||
(entry->matchResult->ntuples >= 0 &&
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);