Re: BUG #17128: minimum numeric 'integer' is -2147483647 not -2147483648 as documented

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: kjs(at)teews(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17128: minimum numeric 'integer' is -2147483647 not -2147483648 as documented
Date: 2021-07-30 15:05:14
Message-ID: CAFBsxsEf6qMvYf5WbDOUdr57mGq18La21R4wNr5=zm4C-1vs6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jul 30, 2021 at 7:53 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The PGTYPESnumeric_to_int function deems -2147483648 to be invalid even
> though it is a perfectly valid 32-bit integer because the code compares to
> -INT_MAX which resolves to -2147483647 on the Fedora/Red Hat and Solaris
> versions I have available to check against.

> - if (l < -INT_MAX || l > INT_MAX)
> + if (l < (-INT_MAX - 1) || l > INT_MAX)

Yeah, that looks like it should be INT_MIN instead. I'll see about making
that happen. Thanks for the report!

--
John Naylor
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-07-30 15:14:32 Re: BUG #17128: minimum numeric 'integer' is -2147483647 not -2147483648 as documented
Previous Message Etsuro Fujita 2021-07-30 12:25:49 Re: The case when AsyncAppend exists also in the qual of Async ForeignScan