diff options
Diffstat (limited to 'src/backend/access/gin/ginget.c')
-rw-r--r-- | src/backend/access/gin/ginget.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index 63dd1f3679f..54aecc1d1f1 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -827,7 +827,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, * in the bitmap. */ while (entry->matchResult == NULL || - (entry->matchResult->ntuples >= 0 && + (!entry->matchResult->lossy && entry->offset >= entry->matchResult->ntuples) || entry->matchResult->blockno < advancePastBlk || (ItemPointerIsLossyPage(&advancePast) && @@ -860,7 +860,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, * We're now on the first page after advancePast which has any * items on it. If it's a lossy result, return that. */ - if (entry->matchResult->ntuples < 0) + if (entry->matchResult->lossy) { ItemPointerSetLossyPage(&entry->curItem, entry->matchResult->blockno); @@ -879,6 +879,8 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, */ if (entry->matchResult->blockno == advancePastBlk) { + Assert(entry->matchResult->ntuples > 0); + /* * First, do a quick check against the last offset on the * page. If that's > advancePast, so are all the other |