@@ -314,31 +314,6 @@ bitmapheap_stream_read_next(ReadStream *pgsr, void *private_data,
314
314
tbmres -> blockno >= hscan -> rs_nblocks )
315
315
continue ;
316
316
317
- /*
318
- * We can skip fetching the heap page if we don't need any fields from
319
- * the heap, the bitmap entries don't need rechecking, and all tuples
320
- * on the page are visible to our transaction.
321
- */
322
- if (!(sscan -> rs_flags & SO_NEED_TUPLES ) &&
323
- !tbmres -> recheck &&
324
- VM_ALL_VISIBLE (sscan -> rs_rd , tbmres -> blockno , & bscan -> rs_vmbuffer ))
325
- {
326
- OffsetNumber offsets [TBM_MAX_TUPLES_PER_PAGE ];
327
- int noffsets ;
328
-
329
- /* can't be lossy in the skip_fetch case */
330
- Assert (!tbmres -> lossy );
331
- Assert (bscan -> rs_empty_tuples_pending >= 0 );
332
-
333
- /*
334
- * We throw away the offsets, but this is the easiest way to get a
335
- * count of tuples.
336
- */
337
- noffsets = tbm_extract_page_tuple (tbmres , offsets , TBM_MAX_TUPLES_PER_PAGE );
338
- bscan -> rs_empty_tuples_pending += noffsets ;
339
- continue ;
340
- }
341
-
342
317
return tbmres -> blockno ;
343
318
}
344
319
@@ -1123,9 +1098,10 @@ heap_beginscan(Relation relation, Snapshot snapshot,
1123
1098
if (flags & SO_TYPE_BITMAPSCAN )
1124
1099
{
1125
1100
BitmapHeapScanDesc bscan = palloc (sizeof (BitmapHeapScanDescData ));
1126
-
1127
- bscan -> rs_vmbuffer = InvalidBuffer ;
1128
- bscan -> rs_empty_tuples_pending = 0 ;
1101
+ /*
1102
+ * Bitmap Heap scans do not have any new fields that a normal Heap
1103
+ * Scan does not have, so no special initializations required here.
1104
+ */
1129
1105
scan = (HeapScanDesc ) bscan ;
1130
1106
}
1131
1107
else
@@ -1280,23 +1256,10 @@ heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params,
1280
1256
scan -> rs_cbuf = InvalidBuffer ;
1281
1257
}
1282
1258
1283
- if (scan -> rs_base .rs_flags & SO_TYPE_BITMAPSCAN )
1284
- {
1285
- BitmapHeapScanDesc bscan = (BitmapHeapScanDesc ) scan ;
1286
-
1287
- /*
1288
- * Reset empty_tuples_pending, a field only used by bitmap heap scan,
1289
- * to avoid incorrectly emitting NULL-filled tuples from a previous
1290
- * scan on rescan.
1291
- */
1292
- bscan -> rs_empty_tuples_pending = 0 ;
1293
-
1294
- if (BufferIsValid (bscan -> rs_vmbuffer ))
1295
- {
1296
- ReleaseBuffer (bscan -> rs_vmbuffer );
1297
- bscan -> rs_vmbuffer = InvalidBuffer ;
1298
- }
1299
- }
1259
+ /*
1260
+ * SO_TYPE_BITMAPSCAN would be cleaned up here, but it does not hold any
1261
+ * additional data vs a normal HeapScan
1262
+ */
1300
1263
1301
1264
/*
1302
1265
* The read stream is reset on rescan. This must be done before
@@ -1325,15 +1288,6 @@ heap_endscan(TableScanDesc sscan)
1325
1288
if (BufferIsValid (scan -> rs_cbuf ))
1326
1289
ReleaseBuffer (scan -> rs_cbuf );
1327
1290
1328
- if (scan -> rs_base .rs_flags & SO_TYPE_BITMAPSCAN )
1329
- {
1330
- BitmapHeapScanDesc bscan = (BitmapHeapScanDesc ) sscan ;
1331
-
1332
- bscan -> rs_empty_tuples_pending = 0 ;
1333
- if (BufferIsValid (bscan -> rs_vmbuffer ))
1334
- ReleaseBuffer (bscan -> rs_vmbuffer );
1335
- }
1336
-
1337
1291
/*
1338
1292
* Must free the read stream before freeing the BufferAccessStrategy.
1339
1293
*/
0 commit comments