mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
BitmapHeapScan: Remove incorrect assert and reset field
04e72ed617
pushed the skip fetch optimization (allowing bitmap heap scans to operate like index-only scans if none of the underlying data is needed) into heap AM implementations of bitmap table scan callbacks.04e72ed617
added an assert that all tuples in blocks eligible for the optimization had been NULL-filled and emitted by the end of the scan. This assert is incorrect when not all tuples need be scanned to execute the query; for example: a join in which not all inner tuples need to be scanned before skipping to the next outer tuple. Remove the assert and reset the field on which it previously asserted to avoid incorrectly emitting NULL-filled tuples from a previous scan on rescan. Author: Melanie Plageman Reviewed-by: Tomas Vondra, Michael Paquier, Alvaro Herrera Reported-by: Melanie Plageman Reproduced-by: Tomas Vondra, Richard Guo Discussion: https://postgr.es/m/CAMbWs48orzZVXa7-vP9Nt7vQWLTE04Qy4PePaLQYsVNQgo6qRg%40mail.gmail.com
This commit is contained in:
@ -1184,7 +1184,12 @@ heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params,
|
||||
scan->rs_vmbuffer = InvalidBuffer;
|
||||
}
|
||||
|
||||
Assert(scan->rs_empty_tuples_pending == 0);
|
||||
/*
|
||||
* Reset rs_empty_tuples_pending, a field only used by bitmap heap scan,
|
||||
* to avoid incorrectly emitting NULL-filled tuples from a previous scan
|
||||
* on rescan.
|
||||
*/
|
||||
scan->rs_empty_tuples_pending = 0;
|
||||
|
||||
/*
|
||||
* The read stream is reset on rescan. This must be done before
|
||||
@ -1216,8 +1221,6 @@ heap_endscan(TableScanDesc sscan)
|
||||
if (BufferIsValid(scan->rs_vmbuffer))
|
||||
ReleaseBuffer(scan->rs_vmbuffer);
|
||||
|
||||
Assert(scan->rs_empty_tuples_pending == 0);
|
||||
|
||||
/*
|
||||
* Must free the read stream before freeing the BufferAccessStrategy.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user