Tighten up range checks for pg_resetwal arguments
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2025-12-03T19:07:14Z
Lists: pgsql-hackers
Attachments
- 0001-pg_resetwal-Reject-negative-and-out-of-range-argumen.patch (text/x-patch) patch 0001
- 0002-pg_resetwal-Use-separate-flags-for-whether-an-option.patch (text/x-patch) patch 0002
While working on the 64-bit multixid offsets patch and commit 94939c5f3a, I got a little annoyed by how lax pg_resetwal is about out-of-range values. These are currently accepted, for example: # Negative XID pg_resetwal -D data -x -1000 # XID larger than 2^32 (on some platforms) pg_resetwal -D data -x 10000000000 The first attached patch tightens up the parsing to reject those. The second attached patch is just refactoring. Currently, we use invalid values for the variables backing each of the options to mean "option was not given". I think it would be more clear to have separate boolean variables for that. I did that for the --multixact-ids option in commit f99e30149f already, because there was no unused value for multixid that we could use. This patch expands that to all the options. - Heikki
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pg_resetwal: Use separate flags for whether an option is given
- 978cf02bb8ca 19 (unreleased) landed
-
pg_resetwal: Reject negative and out of range arguments
- 636c1914b483 19 (unreleased) landed
-
Fix pg_upgrade around multixid and mxoff wraparound
- 94939c5f3ab0 19 (unreleased) cited