Re: Executing pg_createsubscriber with a non-compatible control file
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>, Euler Taveira <euler@eulerto.com>
Date: 2025-10-10T06:07:42Z
Lists: pgsql-hackers
Attachments
- v1-0001-Introduce-API-able-to-retrieve-contents-of-PG_VER.patch (text/x-diff) patch v1-0001
- v1-0002-pg_upgrade-Use-PG_VERSION-generic-routine.patch (text/x-diff) patch v1-0002
- v1-0003-pg_createsubscriber-Use-PG_VERSION-generic-routin.patch (text/x-diff) patch v1-0003
- v1-0004-pg_combinebackup-use-PG_VERSION-generic-routine.patch (text/x-diff) patch v1-0004
- v1-0005-pg_resetwal-use-PG_VERSION-generic-routine.patch (text/x-diff) patch v1-0005
On Thu, Oct 09, 2025 at 11:22:47AM -0700, Masahiko Sawada wrote: > +1, sounds like a good idea to improve user experience. I think we can > use the API in pg_combinebackup.c too since it has a similar function, > read_pg_version_file(). Please find attached what I am finishing with. At the end, I have designed an API that can be reused across the board for the following tools that do the same things in the tree, removing some duplicated code: - pg_resetwal - pg_upgrade - pg_combinebackup The routine that retrieves the contents gets a uint32 number, and it is optionally possible to get the contents of PG_VERSION (pg_upgrade wants that for tablespace paths, but that's really for pg_resetwal to be able to show back buggy data): extern uint32 get_pg_version(const char *datadir, char **version_str); This support both the pre-v10 and the post-v10 version formats, for pg_upgrade. To ease comparisons with PG_MAJORVERSION_NUM, I have added a small helper macro (see GET_PG_MAJORVERSION_NUM). I have also applied the same method to pg_createsubscriber, on top of that, to take care of my original issue. I have not looked at other places where the same concept could be applied, at least it's a start. Thoughts or comments? -- Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pg_checksums: Use new routine to retrieve data of PG_VERSION
- a7c30422004a 19 (unreleased) landed
-
pg_createsubscriber: Use new routine to retrieve data of PG_VERSION
- fa55be2a506a 19 (unreleased) landed
-
pg_resetwal: Use new routine to retrieve data of PG_VERSION
- c6a6cd53d3ab 19 (unreleased) landed
-
pg_combinebackup: Use new routine to retrieve data of PG_VERSION
- e4775e42cade 19 (unreleased) landed
-
pg_upgrade: Use new routine to retrieve data of PG_VERSION
- a7d8052910d6 19 (unreleased) landed
-
Introduce frontend API able to retrieve the contents of PG_VERSION
- cd0be131ba6f 19 (unreleased) landed