pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Introduce frontend API able to retrieve the contents of PG_VERSI
Date: Tue, 14 Oct 2025 07:21:14 +0000
Message-ID: <E1v8ZLO-001cUM-0k@gemulon.postgresql.org> (raw)

Introduce frontend API able to retrieve the contents of PG_VERSION

get_pg_version() is able to return a version number, that can be used
for comparisons based on PG_VERSION_NUM.  A macro is added to convert
the result to a major version number, to work with PG_MAJORVERSION_NUM.

It is possible to pass to the routine an optional argument, where the
contents retrieved from PG_VERSION are saved.  This requirement matters
for some of the frontend code (one example: pg_upgrade wants that for
tablespace paths with a version number strictly older than v10).

This will be used by a set of follow-up patches, to be consumed in
various frontend tools that duplicate a logic similar to do what this
new routine does, like:
- pg_resetwal
- pg_combinebackup
- pg_createsubscriber
- pg_upgrade

This routine supports both the post-v10 version number and the older
flavor (aka 9.6), as required at least by pg_upgrade.

Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/aOiirvWJzwdVCXph@paquier.xyz

Branch
------
master

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

Modified Files
--------------
src/fe_utils/Makefile          |  3 +-
src/fe_utils/meson.build       |  1 +
src/fe_utils/version.c         | 86 ++++++++++++++++++++++++++++++++++++++++++
src/include/fe_utils/version.h | 23 +++++++++++
4 files changed, 112 insertions(+), 1 deletion(-)



Message-ID: <E1v8ZLO-001cUM-0k@gemulon.postgresql.org>
Permalink:  ../E1v8ZLO-001cUM-0k@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1v8ZLO-001cUM-0k@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: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Introduce frontend API able to retrieve the contents of PG_VERSI
  In-Reply-To: <E1v8ZLO-001cUM-0k@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