Thread: BUG #1444: ::int2 parser bug

BUG #1444: ::int2 parser bug

From
"Ioseph Kim"
Date:
The following bug has been logged online:

Bug reference:      1444
Logged by:          Ioseph Kim
Email address:      pgsql-kr@postgresql.or.kr
PostgreSQL version: 7.4x ~
Operating system:   ALL
Description:        ::int2 parser bug
Details:

> select int2(-32768);
  int2
--------
 -32768

--------------------------

> select -32768::int2;
ERROR:  integer out of range
--------------------------

> select '-32768'::int2;
  int2
--------
 -32768

--------------------------

It seems to bug.

This bug occured ::int4 parsing too.

Re: BUG #1444: ::int2 parser bug

From
Tom Lane
Date:
"Ioseph Kim" <pgsql-kr@postgresql.or.kr> writes:
> select -32768::int2;
> ERROR:  integer out of range

This is not a bug, because the interpretation is -(32768::int2)
which indeed is out of range.

            regards, tom lane