Re: 8.1.2 -32768::smallint

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Jean-Gérard Pailloncy <jg(at)rilk(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: 8.1.2 -32768::smallint
Date: 2006-12-13 15:34:38
Message-ID: 20061213153438.GA16723@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Fuhr 2006-12-13 15:43:07 Re: 8.1.2 -32768::smallint
Previous Message Jean-Gérard Pailloncy 2006-12-13 15:03:43 8.1.2 -32768::smallint