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: Improve validation of recovery_target_xid GUC values.
Date: Thu, 05 Mar 2026 12:41:25 +0000
Message-ID: <E1vy817-002W0b-1k@gemulon.postgresql.org> (raw)

Improve validation of recovery_target_xid GUC values.

Previously, the recovery_target_xid GUC values were not sufficiently validated.
As a result, clearly invalid inputs such as the string "bogus", a decimal value
like "1.1", or 0 (a transaction ID smaller than the minimum valid value of 3)
were unexpectedly accepted. In these cases, the value was interpreted as
transaction ID 0, which could cause recovery to behave unexpectedly.

This commit improves validation of recovery_target_xid GUC so that invalid
values are rejected with an error. This prevents recovery from proceeding
with misconfigured recovery_target_xid settings.

Also this commit updates the documentation to clarify the allowed values
for recovery_target_xid GUC.

Author: David Steele <david@pgbackrest.org>
Reviewed-by: Hüseyin Demir <huseyin.d3r@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/f14463ab-990b-4ae9-a177-998d2677aae0@pgbackrest.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bffd7130e942e2bd45153ab09e5fab70e74ece58

Modified Files
--------------
doc/src/sgml/config.sgml                    | 15 ++++++++++++++
src/backend/access/transam/xlogrecovery.c   | 31 +++++++++++++++++++++++++++--
src/test/recovery/t/003_recovery_targets.pl | 22 ++++++++++++++++++++
3 files changed, 66 insertions(+), 2 deletions(-)



Message-ID: <E1vy817-002W0b-1k@gemulon.postgresql.org>
Permalink:  ../E1vy817-002W0b-1k@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vy817-002W0b-1k@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: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve validation of recovery_target_xid GUC values.
  In-Reply-To: <E1vy817-002W0b-1k@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