Re: Casting on the limit

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: Ottó Havasvölgyi <havasvolgyi(dot)otto(at)gmail(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Casting on the limit
Date: 2008-01-21 09:42:19
Message-ID: 479468FB.4000205@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ottó Havasvölgyi 2008-01-21 11:08:42 Re: Casting on the limit
Previous Message Roman 2008-01-21 08:20:22 BUG #3892: Invalid week determination