Re: BUG #17128: minimum numeric 'integer' is -2147483647 not -2147483648 as documented
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: John Naylor <john.naylor@enterprisedb.com>
Cc: kjs@teews.com, pgsql-bugs@lists.postgresql.org
Date: 2021-07-30T15:14:32Z
Lists: pgsql-bugs
John Naylor <john.naylor@enterprisedb.com> writes: > On Fri, Jul 30, 2021 at 7:53 AM PG Bug reporting form < > noreply@postgresql.org> wrote: >> - 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! The whole stanza perhaps ought to be within #if SIZEOF_LONG > SIZEOF_INT otherwise some compilers will bleat about useless tests. (I looked at PGTYPESnumeric_to_long and it seems like it will do the right thing for 32-bit long, assuming strtol does.) regards, tom lane
Commits
-
Fix range check in ECPG numeric to int conversion
- 231c19a8987a 10.18 landed
- cfcb0ceabde1 9.6.23 landed
- f051b87ace6d 14.0 landed
- 171bf1cea579 13.4 landed
- c7181a32c57d 11.13 landed
- d9589eb62a2b 12.8 landed
- 5fcf3945bd90 15.0 landed