Re: Bug with int2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Feng Tian <ftian(at)vitessedata(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug with int2
Date: 2016-02-17 03:46:06
Message-ID: 18526.1455680766@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Feng Tian <ftian(at)vitessedata(dot)com> writes:
> I run into the following. Seems this is a bug for -32768, which should be
> a valid smallint value.

> ftian=# select -32768::int2;
> ERROR: smallint out of range

You have the wrong idea about the precedence of those operators.
"select (-32768)::int2" works.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-02-17 03:46:25 Re: Bug with int2
Previous Message Tom Lane 2016-02-17 03:44:03 Re: How are CREATE EXTENSION ... VERSION or ALTER EXTENSION ... UPDATE TO ... intended to work?