Re: Casting on the limit - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Re: Casting on the limit
Date
Msg-id 479468FB.4000205@enterprisedb.com
Whole thread Raw
In response to Casting on the limit  ("Ottó Havasvölgyi" <havasvolgyi.otto@gmail.com>)
Responses Re: Casting on the limit
List pgsql-bugs
Ottó Havasvölgyi wrote:
> In 8.2.5:
>
> This does not work (out of range):
> select -32768::int2
>
> But this works:
> select cast(-32768 as int2);
>
> What is the difference between the two syntax in the background? I
> always thought they are the same.

"select -32768::int2" is equal to "select -(32768::int2)", and 32768
doesn't fit in an int2.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-bugs by date:

Previous
From: "Roman"
Date:
Subject: BUG #3892: Invalid week determination
Next
From: "Ottó Havasvölgyi"
Date:
Subject: Re: Casting on the limit