| From: | David Rowley <drowley(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix incorrect block accounting in TID Range Scans |
| Date: | 2026-09-23 13:22:01 |
| Message-ID: | E1x9MvB-00000000vPC-1Glk@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix incorrect block accounting in TID Range Scans
heapgettup_advance_block() (or heapgettup() and heapgettup_pagemode() in
versions before v16) would incorrectly decrement rs_numblocks when
advancing to the next block. Ordinarily this was fine, but if the TID
Range scan plan was used by a scrollable cursor and the cursor was fetched
backwards enough to result in another block being required, then
rs_numblocks may have reached 0 prematurely resulting in the scan ending
prematurely.
Reported-by: Jeff Davis <pgsql(at)j-davis(dot)com>
Author: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/c84dd31bd9f5c2ba1ca79615d405ea0bf00c51a2
Modified Files
--------------
src/backend/access/heap/heapam.c | 48 +++++++++++++++++++++++++-----
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++
src/test/regress/sql/tidrangescan.sql | 12 ++++++++
3 files changed, 78 insertions(+), 8 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2026-09-23 18:20:49 | Re: pgsql: JSON_TABLE: propagate table-level ON ERROR to columns per SQL st |
| Previous Message | David Rowley | 2026-09-23 13:21:39 | pgsql: Fix incorrect block accounting in TID Range Scans |