pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix _bt_readnextpage half-dead leftmost page assert.
Date: Thu, 15 Oct 2026 16:18:37 +0000
Message-ID: <E1xHOA9-00000001ktI-0P0l@gemulon.postgresql.org> (raw)

Fix _bt_readnextpage half-dead leftmost page assert.

Backwards scans that reach a half-dead leftmost leaf page step over the
page without calling _bt_readpage.  This happens whenever the most
recent _bt_lock_and_validate_left call returned a half-dead leftmost
page.  An assertion within _bt_readnextpage failed to consider this,
causing it to fail spuriously.

To fix, make the assertion accept the case where currPage doesn't match
lastcurrblkno as long as blkno is P_NONE (it's always P_NONE when the
last leaf page examined by _bt_readnextpage is either the leftmost or
rightmost page).

Oversight in commit caca6d8d27.

Author: Peter Geoghegan <pg@bowt.ie>
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6d4ee9203686d0426ec089ce965a96a86ef4651d

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1xHOA9-00000001ktI-0P0l@gemulon.postgresql.org>
Permalink:  ../E1xHOA9-00000001ktI-0P0l@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xHOA9-00000001ktI-0P0l@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: pg@bowt.ie
  Subject: Re: pgsql: Fix _bt_readnextpage half-dead leftmost page assert.
  In-Reply-To: <E1xHOA9-00000001ktI-0P0l@gemulon.postgresql.org>
  References: <E1xHOA9-00000001ktI-0P0l@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox