pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use pg_parse_lsn() for timeline history switchpoints
Date: Thu, 22 Oct 2026 08:36:43 +0000
Message-ID: <E1xJoHz-00000000Iy0-2qhn@gemulon.postgresql.org> (raw)

Use pg_parse_lsn() for timeline history switchpoints

readTimeLineHistory() previously parsed WAL switchpoints in timeline
history files using sscanf("%X/%08X") into uint32 values. An
overlong high component could overflow, while an overlong low component
was truncated to its first eight digits. Trailing characters were also
ignored.

Extract the switchpoint token and use pg_parse_lsn() to validate and
convert it, requiring one to eight hexadecimal digits per component
with no trailing characters, as for pg_lsn input. This matches the
change to pg_rewind's history file parser in commit f31d6fbc31d.

Author: Jan Nidzwetzki <jan@planetscale.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/8b1abbd0-7335-4e68-93ec-91cdbbfd9568@planetscale.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5ffb8c7409385c58e5c1abaa22ee77ba4c1b5c33

Modified Files
--------------
src/backend/access/transam/timeline.c | 37 +++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)



Message-ID: <E1xJoHz-00000000Iy0-2qhn@gemulon.postgresql.org>
Permalink:  ../E1xJoHz-00000000Iy0-2qhn@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xJoHz-00000000Iy0-2qhn@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: fujii@postgresql.org
  Subject: Re: pgsql: Use pg_parse_lsn() for timeline history switchpoints
  In-Reply-To: <E1xJoHz-00000000Iy0-2qhn@gemulon.postgresql.org>
  References: <E1xJoHz-00000000Iy0-2qhn@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