Re: Bug with int2 - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Bug with int2
Date
Msg-id CAB7nPqTkExBp3FE5wBhhoH6QiQ0Cx-GgqcuzZm+SXgxocq6XxA@mail.gmail.com
Whole thread Raw
In response to Bug with int2  (Feng Tian <ftian@vitessedata.com>)
List pgsql-hackers
On Wed, Feb 17, 2016 at 12:27 PM, Feng Tian <ftian@vitessedata.com> wrote:
> ftian=# select -32768::int2;
> ERROR:  smallint out of range

But 32768 is not. You should just use parenthesis, a cast does not
take into account the minus sign here:
=# select (-32768)::int2; int2
---------32768
(1 row)
-- 
Michael



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug with int2
Next
From: Peter Geoghegan
Date:
Subject: Re: Bug with int2