Re: Tighten up range checks for pg_resetwal arguments

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tighten up range checks for pg_resetwal arguments
Date: 2025-12-08 14:56:22
Message-ID: 218dd7a1-e6e3-495a-9a00-e9cc9628ce2f@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-12-08 14:58:00 Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions
Previous Message Tom Lane 2025-12-08 14:51:06 Re: Make copyObject work in C++