Re: When is int32 not an int32? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: When is int32 not an int32?
Date
Msg-id 2671909.1632698725@sss.pgh.pa.us
Whole thread Raw
In response to Re: When is int32 not an int32?  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: When is int32 not an int32?  ("David E. Wheeler" <david@justatheory.com>)
List pgsql-hackers
"David E. Wheeler" <david@justatheory.com> writes:
> On Sep 26, 2021, at 18:31, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I'd bet more along the lines of "your overflow check is less portable than
>> you thought”.

> Oh well now that you mention it and I look past things, I see we’re using INT_MAX, but should probably use INT32_MAX.

More to the point, you should be checking whether strtol reports overflow.
Having now seen your code, I'll opine that the failing platforms have
32-bit long.

            regards, tom lane



pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: When is int32 not an int32?
Next
From: Tatsuro Yamada
Date:
Subject: Add prefix pg_catalog to pg_get_statisticsobjdef_columns() in describe.c (\dX)