diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 0755be8390..5a17112c91 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -2132,9 +2132,11 @@ heapam_scan_bitmap_next_block(TableScanDesc scan, * Ignore any claimed entries past what we think is the end of the * relation. It may have been extended after the start of our scan (we * only hold an AccessShareLock, and it could be inserts from this - * backend). + * backend). We don't take this optimization in SERIALIZABLE isolation + * though, as we need to examine all invisible tuples reachable by the + * index. */ - if (block >= hscan->rs_nblocks) + if (!IsolationIsSerializable() && block >= hscan->rs_nblocks) return false; /*