Re: 5 is not a smallint but '5' is

Поиск
Список
Период
Сортировка
От bricklen
Тема Re: 5 is not a smallint but '5' is
Дата
Msg-id CAGrpgQ9tJsOHcF4B4UU-k+s9D3WFL4POWiaEVK3NeQ6So_6G1Q@mail.gmail.com
обсуждение исходный текст
Ответ на 5 is not a smallint but '5' is  (John DeSoi <desoi@pgedit.com>)
Список pgsql-general
On Mon, Jul 29, 2013 at 8:11 AM, John DeSoi <desoi@pgedit.com> wrote:
I was surprised to discover this today. I can work around it, but it seems counterintuitive. If 5 can't be parsed as a smallint, I would feel better if '5' was not one either.


temp=# create or replace function itest (param smallint) returns integer as $$ select $1 + 5; $$ language sql;
CREATE FUNCTION
temp=# select itest(5);
ERROR:  function itest(integer) does not exist
LINE 1: select itest(5);
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
temp=# select itest('5');
 itest
-------
    10
(1 row)



FWIW, It works if you don't rely on the implicit cast, and explicitly cast it to smallint:

select itest(5::smallint);
 itest
-------
    10

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

Предыдущее
От: Ian Lawrence Barwick
Дата:
Сообщение: Re: Viewing another role's search path?
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: how to get UPDATEXML function in postgresql as it works in oracle