Thread: Integer/BigInt Implicit Typing Bug

Integer/BigInt Implicit Typing Bug

From
pmcneill@berkleemusic.com
Date:
In the 7.4.1 release, I've found that it implicitly types INT_MIN,
-2147483648, as a 64-bit integer instead of a 32-bit integer.  Here's a test
case:

select "bit"(-2147483647);
               bit
----------------------------------
 10000000000000000000000000000001

select "bit"(-2147483648 + 1);
                               bit
------------------------------------------------------------------
 1111111111111111111111111111111110000000000000000000000000000001

-Patrick McNeill

Re: Integer/BigInt Implicit Typing Bug

From
Tom Lane
Date:
pmcneill@berkleemusic.com writes:
> In the 7.4.1 release, I've found that it implicitly types INT_MIN,
> -2147483648, as a 64-bit integer instead of a 32-bit integer.

This is not a bug, and the reason is that "-" is a separate operator.
"2147483648" is an int8 constant.

            regards, tom lane