Matt Musgrove <MMusgrove@efji.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> By and large it's best not to use smallint as the declared argument type of a function unless you really have to.
> Thank you for the quick response.
> Is this documented? If so, where?
Well, the initial typing of numeric constants is documented in
http://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS
under 4.1.2.6 Numeric Constants.
The fact that the integer->smallint coercion is assignment and not
implicit is probably not stated anywhere in so many words, but there are
at least a couple of places that say that down-casts to more restricted
types are not normally applied implicitly. (The only one I remember
offhand is in the CREATE CAST reference page, but I think it's explained
in the main text someplace, possibly in chapter 10.) In practice I
think people would look into the catalogs, eg with psql's \dC, if they
wanted that particular detail.
I don't believe we say anywhere that "functions with smallint arguments
are a bad idea", if that's what you were looking for.
regards, tom lane