Steve Atkins <[EMAIL PROTECTED]> writes:
>> test=> select -2147483648::int;
>> ERROR:  integer out of range

There is no bug here.  You are mistakenly assuming that the above
represents
        select (-2147483648)::int;
But actually the :: operator binds more tightly than unary minus,
so Postgres reads it as
        select -(2147483648::int);
and quite rightly fails to convert the int8 literal to int.

If you write it with the correct parenthesization it works:

regression=# select -2147483648::int;
ERROR:  integer out of range
regression=# select (-2147483648)::int;
    int4
-------------
 -2147483648
(1 row)


                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to