Content-Length: 337540 | pFad | http://github.com/postgrespro/postgres_cluster/commit/e34ec136201df07a05a83825ebff7fffb9043598

F5 Allow CALL with polymorphic type arguments · postgrespro/postgres_cluster@e34ec13 · GitHub
Skip to content

Commit e34ec13

Browse files
committed
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.
1 parent 0ce5cf2 commit e34ec13

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/backend/commands/functioncmds.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,6 +2264,7 @@ ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver
22642264
/* Initialize function call structure */
22652265
InvokeFunctionExecuteHook(fexpr->funcid);
22662266
fmgr_info(fexpr->funcid, &flinfo);
2267+
fmgr_info_set_expr((Node *) fexpr, &flinfo);
22672268
InitFunctionCallInfoData(fcinfo, &flinfo, nargs, fexpr->inputcollid, (Node *) callcontext, NULL);
22682269

22692270
/*

src/test/regress/expected/create_procedure.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ SELECT * FROM cp_test;
116116
100 | Hello
117117
(8 rows)
118118

119+
-- polymorphic types
120+
CREATE PROCEDURE ptest6(a int, b anyelement)
121+
LANGUAGE SQL
122+
AS $$
123+
SELECT NULL::int;
124+
$$;
125+
CALL ptest6(1, 2);
119126
-- various error cases
120127
CALL version(); -- error: not a procedure
121128
ERROR: version() is not a procedure

src/test/regress/sql/create_procedure.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ CALL ptest5(b => 'Hello', a => 10);
8484
SELECT * FROM cp_test;
8585

8686

87+
-- polymorphic types
88+
89+
CREATE PROCEDURE ptest6(a int, b anyelement)
90+
LANGUAGE SQL
91+
AS $$
92+
SELECT NULL::int;
93+
$$;
94+
95+
CALL ptest6(1, 2);
96+
97+
8798
-- various error cases
8899

89100
CALL version(); -- error: not a procedure

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/e34ec136201df07a05a83825ebff7fffb9043598

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy