Re: 8.1.2 -32768::smallint - Mailing list pgsql-bugs

From Michael Fuhr
Subject Re: 8.1.2 -32768::smallint
Date
Msg-id 20061213153438.GA16723@winnie.fuhr.org
Whole thread Raw
In response to 8.1.2 -32768::smallint  (Jean-Gérard Pailloncy <jg@rilk.com>)
Responses Re: 8.1.2 -32768::smallint  (Michael Fuhr <mike@fuhr.org>)
Re: 8.1.2 -32768::smallint  (Jean-Gérard Pailloncy <jg@rilk.com>)
List pgsql-bugs
On Wed, Dec 13, 2006 at 03:03:43PM -0000, Jean-Gérard Pailloncy wrote:
> On PostgreSQL 8.1.2
> select -32768::smallint
> throws the error
> ERROR:  smallint out of range

I think the cast is binding tighter than the unary minus, so the
above is equivalent to

select -(32768::smallint)

which is why you're getting "smallint out of range."  This should work:

select (-32768)::smallint

--
Michael Fuhr

pgsql-bugs by date:

Previous
From: Jean-Gérard Pailloncy
Date:
Subject: 8.1.2 -32768::smallint
Next
From: Michael Fuhr
Date:
Subject: Re: 8.1.2 -32768::smallint