diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 8d44b932317..0737cd06643 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -2247,9 +2247,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 (page >= hscan->rs_nblocks) + if (!IsolationIsSerializable() && page >= hscan->rs_nblocks) return false; /*