BUG #2108: Function with OUT parameters not recognized, using plpgsql

From: "Tony" <tony(at)vectorsalad(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2108: Function with OUT parameters not recognized, using plpgsql
Date: 2005-12-11 23:57:05
Message-ID: 20051211235705.173CEF0B17@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches


The following bug has been logged online:

Bug reference: 2108
Logged by: Tony
Email address: tony(at)vectorsalad(dot)com
PostgreSQL version: 8.1.0
Operating system: Debian 1:3.3.5-8ubuntu2, 2.6.10-5-k7, i686
Description: Function with OUT parameters not recognized, using
plpgsql
Details:

Defined a function with OUT paramter. Attempts to call it fail as the
function can not be found.

Example:

<code>

CREATE OR REPLACE FUNCTION f_multiparam (
i1 integer,
i2 varchar,
OUT o1 varchar
) AS
$$
BEGIN
o1 := 'i2 was ' || i2;
END;
$$
LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION f_showperformstatus () RETURNS varchar AS
$$
DECLARE
outparameter varchar;
BEGIN
PERFORM f_multiparam(1, 'hello', outparameter);
RETURN 'successfully run';
END;
$$
LANGUAGE plpgsql;

select f_showperformstatus();

</code>

Output:

CREATE FUNCTION
CREATE FUNCTION
psql:bug2.sql:24: ERROR: function f_multiparam(integer, "unknown",
character varying) does not exist
HINT: No function matches the given name and argument types. You may need
to add explicit type casts.
CONTEXT: SQL statement "SELECT f_multiparam(1, 'hello', $1 )"
PL/pgSQL function "f_showperformstatus" line 4 at perform

It appears that the function is not defined properly in the system, with
only 2 parameters instead of 3:

\df f_multiparam
List of functions
Schema | Name | Result data type | Argument data types
--------+--------------+-------------------+----------------------------
apps | f_multiparam | character varying | integer, character varying

Explicitly casting the value 'hello' as suggested does not help. Changing
the function definition from OUT to INOUT parameter is a successful
workaround.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Micha Szelg 2005-12-12 13:38:37 BUG #2109: NULL=NULL is false
Previous Message Tony S 2005-12-11 23:44:59 BUG #2107: Function INOUT parameter not returned to caller, causes plpgsql malfunctions

Browse pgsql-patches by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-12-12 01:39:20 Re: running script on server shutdown (TODO)
Previous Message Mark Kirkwood 2005-12-11 22:20:42 Re: running script on server shutdown (TODO)