pgsql: pg_checksums: Use new routine to retrieve data of PG_VERSION

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_checksums: Use new routine to retrieve data of PG_VERSION
Date: 2025-10-20 00:36:06
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_checksums: Use new routine to retrieve data of PG_VERSION

Previously, attempting to use pg_checksums on a cluster with a control
file whose version does not match with what thetool is able to support
would lead to the following error:
pg_checksums: error: pg_control CRC value is incorrect

This is confusing, because it would look like the control file is
corrupted. However, the contents of the control file are correct,
pg_checksums not being able to understand how the past control file is
shaped.

This commit adds a check based on PG_VERSION, using the facility added
by cd0be131ba6f, using the same error message as some of the other
frontend tools. A note is added in the documentation about the major
version requirement.

Author: Michael Banck <mbanck(at)gmx(dot)net>
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/ref/pg_checksums.sgml | 4 ++++
src/bin/pg_checksums/pg_checksums.c | 17 +++++++++++++++++
2 files changed, 21 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2025-10-20 02:46:41 pgsql: pg_dump: Remove unnecessary code for security labels on extensio
Previous Message Tom Lane 2025-10-19 22:29:02 pgsql: Add static assertion that RELSEG_SIZE fits in an int.