Re: BUG #1526: SHRT_MIN out of range on explicit type conversion - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1526: SHRT_MIN out of range on explicit type conversion
Date
Msg-id 14097.1109998160@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1526: SHRT_MIN out of range on explicit type conversion  ("Kelly Burkhart" <pgkrb@kkcsm.net>)
List pgsql-bugs
"Kelly Burkhart" <pgkrb@kkcsm.net> writes:
> From psql, the following will fail:

> select -32768::int2;

This is not a bug.  The reason is that :: binds more tightly than -,
so what you have written is equivalent to

select -(32768::int2);

which obviously *should* fail.  Try it as

select (-32768)::int2;

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1527: select retrieves 0 rows after vacuum analyze
Next
From: Kris Jurka
Date:
Subject: Re: BUG #1525: wrong time when getting timestamp from date