Tighten up range checks for pg_resetwal arguments - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Tighten up range checks for pg_resetwal arguments
Date
Msg-id 81adf5f3-36ad-4bcd-9ba5-1b95c7b7a807@iki.fi
Whole thread Raw
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Alexandra Wang
Date:
Subject: Re: Is there value in having optimizer stats for joins/foreignkeys?
Next
From: Peter Eisentraut
Date:
Subject: Re: Consistently use palloc_object() and palloc_array()