On Fri, Sep 3, 2010 at 9:19 PM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
> The problem I'm facing is functions declared to take type smallint not
> working unless the integer literal has an explicit cast. Currently the
> best answer is simply to avoid using smallint in functions, but this
> isn't completely satisfying.
Maybe the lexer isn't the right place to fix this. The problem here
(or so I gather) is that if I say foo(1), then 1 is an integer and
we'll do an "implicit" cast to bigint, real, double precision,
numeric, oid, or reg*, but the cast to smallint is assignment-only.
But I wonder if we shouldn't allow implicit casting anyway when there
is a unique best match. If the only foo(x) function is foo(smallint)
and the user tries to call foo with one argument, what else can it
mean?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company