Re: lexing small ints as int2

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: lexing small ints as int2
Дата
Msg-id AANLkTiksn5+-1=w4efm=6zjFs1Ov_MN-h4rLbiQrCua7@mail.gmail.com
обсуждение исходный текст
Ответ на Re: lexing small ints as int2  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: lexing small ints as int2  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: lexing small ints as int2
Следующее
От: Tom Lane
Дата:
Сообщение: Re: lexing small ints as int2