agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix incorrect block accounting in TID Range Scans
Date: Wed, 23 Sep 2026 13:20:46 +0000
Message-ID: <E1x9Mty-00000000vJz-0bze@gemulon.postgresql.org> (raw)
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@j-davis.com>
Author: Ewan Young <kdbase.hack@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/25ebf0097fcc1aaf7bb56816e7508142c1613ab9
Modified Files
--------------
src/backend/access/heap/heapam.c | 20 +++++++++++---------
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/tidrangescan.sql | 12 ++++++++++++
3 files changed, 49 insertions(+), 9 deletions(-)
view thread (7+ messages) latest in thread
Message-ID: <E1x9Mty-00000000vJz-0bze@gemulon.postgresql.org>
Permalink: ../E1x9Mty-00000000vJz-0bze@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x9Mty-00000000vJz-0bze@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix incorrect block accounting in TID Range Scans
In-Reply-To: <E1x9Mty-00000000vJz-0bze@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox