Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

Next:From: Michael FuhrDate: 2006-12-13 15:43:07
Subject: Re: 8.1.2 -32768::smallint
Previous:From: Jean-Gérard PailloncyDate: 2006-12-13 15:03:43
Subject: 8.1.2 -32768::smallint

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group