Re: pg_amcheck: Fix block number parsing on command line - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: pg_amcheck: Fix block number parsing on command line
Date
Msg-id E2D4E4A5-E2CA-4B1A-9558-73C7EF27E61C@enterprisedb.com
Whole thread Raw
In response to pg_amcheck: Fix block number parsing on command line  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: pg_amcheck: Fix block number parsing on command line  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List pgsql-hackers

> On Jul 22, 2021, at 7:56 AM, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
>
> Please check that it's up to speed.
> <0001-pg_amcheck-Fix-block-number-parsing-on-command-line.patch>

This looks correct to me.  Thanks for the fix.

Your use of strtoul compares favorably to that in pg_resetwal in that you are checking errno and it is not.  The
consequenceis: 

bin % ./pg_resetwal/pg_resetwal -e 1111111111111111111111111111111111111111111111111111
pg_resetwal: error: transaction ID epoch (-e) must not be -1
bin % ./pg_resetwal/pg_resetwal -e junkstring
pg_resetwal: error: invalid argument for option -e
Try "pg_resetwal --help" for more information.

Unless people are relying on this behavior, I would think pg_resetwal should complain of an invalid argument for both
ofthose, rather than complaining about -1.  That's not to do with this patch, but if we're tightening up the use of
strtolin frontend tools, maybe we can use the identical logic in both places. 

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: proposal: enhancing plpgsql debug API - returns text value of variable content
Next
From: Alvaro Herrera
Date:
Subject: Re: Rename of triggers for partitioned tables