Re: Smallint needs explicit cast in psql?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matt Musgrove <MMusgrove(at)efji(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>, Judy Loomis <JLoomis(at)efji(dot)com>
Subject: Re: Smallint needs explicit cast in psql?
Date: 2012-07-16 17:03:50
Message-ID: 13145.1342458230@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Matt Musgrove <MMusgrove(at)efji(dot)com> writes:
> Does psql require smallints to be explicitly cast as such?

Undecorated integer-looking constants are taken as integer, bigint, or
numeric depending on size. Not smallint. By and large it's best
not to use smallint as the declared argument type of a function unless
you really have to.

(We have looked into allowing small-enough literals to be taken as
smallint. Turns out to break a whole lot of stuff, by introducing
ambiguities where there were none before, so it's not likely
to ever happen.)

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Matt Musgrove 2012-07-16 17:24:46 Re: Smallint needs explicit cast in psql?
Previous Message Matt Musgrove 2012-07-16 16:38:43 Smallint needs explicit cast in psql?