@@ -2183,7 +2183,9 @@ _bt_readfirstpage(IndexScanDesc scan, OffsetNumber offnum, ScanDirection dir)
2183
2183
* scan. A seized=false caller's blkno can never be assumed to be the page
2184
2184
* that must be read next during a parallel scan, though. We must figure that
2185
2185
* part out for ourselves by seizing the scan (the correct page to read might
2186
- * already be beyond the seized=false caller's blkno during a parallel scan).
2186
+ * already be beyond the seized=false caller's blkno during a parallel scan,
2187
+ * unless blkno/so->currPos.nextPage/so->currPos.prevPage is already P_NONE,
2188
+ * or unless so->currPos.moreRight/so->currPos.moreLeft is already unset).
2187
2189
*
2188
2190
* On success exit, so->currPos is updated to contain data from the next
2189
2191
* interesting page, and we return true. We hold a pin on the buffer on
@@ -2204,6 +2206,7 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
2204
2206
BTScanOpaque so = (BTScanOpaque )scan -> opaque ;
2205
2207
2206
2208
Assert (so -> currPos .currPage == lastcurrblkno || seized );
2209
+ Assert (!(blkno == P_NONE && seized ));
2207
2210
Assert (!BTScanPosIsPinned (so -> currPos ));
2208
2211
2209
2212
/*