Re: When is int32 not an int32?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: When is int32 not an int32?
Date: 2021-09-26 23:25:25
Message-ID: 2671909.1632698725@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David E. Wheeler" <david(at)justatheory(dot)com> writes:
> On Sep 26, 2021, at 18:31, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-09-27 00:08:45 Re: should INSERT SELECT use a BulkInsertState?
Previous Message David E. Wheeler 2021-09-26 23:06:45 Re: When is int32 not an int32?