5 is not a smallint but '5' is

From: John DeSoi <desoi(at)pgedit(dot)com>
To: "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org>
Subject: 5 is not a smallint but '5' is
Date: 2013-07-29 15:11:06
Message-ID: AA02CF30-C2CE-4100-B4D7-DD559D413FC2@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

John DeSoi, Ph.D.

psql (9.2.4)
Type "help" for help.

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)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-07-29 15:11:21 Re: Incorrect response code after XA recovery
Previous Message Tom Jenkinson 2013-07-29 14:57:35 Re: Incorrect response code after XA recovery