Allow CALL with polymorphic type arguments

In order to be able to resolve polymorphic types, we need to set fn_expr
before invoking the procedure.
pull/32/head
Peter Eisentraut 7 years ago
parent 0ce5cf2ef2
commit e34ec13620
  1. 1
      src/backend/commands/functioncmds.c
  2. 7
      src/test/regress/expected/create_procedure.out
  3. 11
      src/test/regress/sql/create_procedure.sql

@ -2264,6 +2264,7 @@ ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver
/* Initialize function call structure */
InvokeFunctionExecuteHook(fexpr->funcid);
fmgr_info(fexpr->funcid, &flinfo);
fmgr_info_set_expr((Node *) fexpr, &flinfo);
InitFunctionCallInfoData(fcinfo, &flinfo, nargs, fexpr->inputcollid, (Node *) callcontext, NULL);
/*

@ -116,6 +116,13 @@ SELECT * FROM cp_test;
100 | Hello
(8 rows)
-- polymorphic types
CREATE PROCEDURE ptest6(a int, b anyelement)
LANGUAGE SQL
AS $$
SELECT NULL::int;
$$;
CALL ptest6(1, 2);
-- various error cases
CALL version(); -- error: not a procedure
ERROR: version() is not a procedure

@ -84,6 +84,17 @@ CALL ptest5(b => 'Hello', a => 10);
SELECT * FROM cp_test;
-- polymorphic types
CREATE PROCEDURE ptest6(a int, b anyelement)
LANGUAGE SQL
AS $$
SELECT NULL::int;
$$;
CALL ptest6(1, 2);
-- various error cases
CALL version(); -- error: not a procedure

Loading…
Cancel
Save