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

From Heikki Linnakangas
Subject Re: Tighten up range checks for pg_resetwal arguments
Date
Msg-id 218dd7a1-e6e3-495a-9a00-e9cc9628ce2f@iki.fi
Whole thread Raw
In response to Re: Tighten up range checks for pg_resetwal arguments  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
On 05/12/2025 20:09, Heikki Linnakangas wrote:
> On 04/12/2025 03:08, Chao Li wrote:
>> I guess this function doesn’t have to check “-“ by itself, it leads 
>> some edge-case not to be well handled, for example “-0” is still 0, 
>> not a negative value. We can use strtoll() convert input string to a 
>> singed long long, and check if value is negative.
> 
> True. I originally wrote this for the 64-bit variant which will be used 
> in the 64-bit offsets patch. For that we can't use strtoll().

I think it's best to reject the "-0" case, so I kept the code so that 
it's rejected, and added a test for that.

Committed, thanks for the review!

- Heikki




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Make copyObject work in C++
Next
From: jian he
Date:
Subject: Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions