diff options
| author | Melanie Plageman <melanieplageman@gmail.com> | 2025-02-24 16:07:50 -0500 |
|---|---|---|
| committer | Melanie Plageman <melanieplageman@gmail.com> | 2025-02-24 16:10:13 -0500 |
| commit | b8778c4cd8bc924ce5347cb1ab10dfbf34130559 (patch) | |
| tree | e04294273340adff516f244bc56550644b9f5d87 /src/backend/access/gin | |
| parent | c56e8af75e081383e05cf544f372506c8da4efe7 (diff) | |
Add lossy indicator to TBMIterateResult
TBMIterateResult->ntuples is -1 when the page in the bitmap is lossy.
Add an explicit lossy indicator so that we can move ntuples out of the
TBMIterateResult in a future commit.
Discussion: https://postgr.es/m/CA%2BhUKGLHbKP3jwJ6_%2BhnGi37Pw3BD5j2amjV3oSk7j-KyCnY7Q%40mail.gmail.com
Diffstat (limited to 'src/backend/access/gin')
| -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 |
