Re: BUG #1526: SHRT_MIN out of range on explicit type conversion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kelly Burkhart" <pgkrb(at)kkcsm(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1526: SHRT_MIN out of range on explicit type conversion
Date: 2005-03-05 04:49:20
Message-ID: 14097.1109998160@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Kelly Burkhart" <pgkrb(at)kkcsm(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kris Jurka 2005-03-05 05:11:06 Re: BUG #1525: wrong time when getting timestamp from date
Previous Message Tom Lane 2005-03-05 04:46:28 Re: BUG #1527: select retrieves 0 rows after vacuum analyze