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

Поиск
Список
Период
Сортировка
От Tony
Тема BUG #2108: Function with OUT parameters not recognized, using plpgsql
Дата
Msg-id 20051211235705.173CEF0B17@svr2.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #2108: Function with OUT parameters not recognized, using plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #2108: Function with OUT parameters not recognized, using plpgsql  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      2108
Logged by:          Tony
Email address:      tony@vectorsalad.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.

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

Предыдущее
От: "Tony S"
Дата:
Сообщение: BUG #2107: Function INOUT parameter not returned to caller, causes plpgsql malfunctions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2107: Function INOUT parameter not returned to caller, causes plpgsql malfunctions