Re: calling function - Mailing list pgsql-sql

From Tom Lane
Subject Re: calling function
Date
Msg-id 22336.1078382451@sss.pgh.pa.us
Whole thread Raw
In response to calling function  ("William Anthony Lim" <wei.liang@eudoramail.com>)
List pgsql-sql
"William Anthony Lim" <wei.liang@eudoramail.com> writes:
> create or replace function testcall(int4,varchar,bool,int2) return setof record as '
> ...
> select * from testcall(12,'ABCD',true,20000);
> ERROR:  function testcall(integer, "unknown", boolean, integer) does not exist

An undecorated integer constant is considered int4 (or int8 or numeric
if large enough), and there's no automatic downcast to int2.  You could
write 20000::int2 or some such, but on the whole I'd recommend declaring
the function to take int4 not int2.
        regards, tom lane


pgsql-sql by date:

Previous
From: "William Anthony Lim"
Date:
Subject: calling function
Next
From: Achilleus Mantzios
Date:
Subject: Re: Encoding bytea