In order to be able to resolve polymorphic types, we need to set fn_expr
before invoking the procedure.
/* 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);
/*
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
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