aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index a4b6e1effdb..6e926ef4eed 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -746,6 +746,7 @@ init_sql_fcache(FunctionCallInfo fcinfo, Oid collation, bool lazyEvalOK)
fcache->returnsTuple = check_sql_fn_retval(queryTree_list,
rettype,
rettupdesc,
+ procedureStruct->prokind,
false,
&resulttlist);
@@ -1606,6 +1607,7 @@ check_sql_fn_statements(List *queryTreeLists)
bool
check_sql_fn_retval(List *queryTreeLists,
Oid rettype, TupleDesc rettupdesc,
+ char prokind,
bool insertDroppedCols,
List **resultTargetList)
{
@@ -1625,7 +1627,7 @@ check_sql_fn_retval(List *queryTreeLists,
/*
* If it's declared to return VOID, we don't care what's in the function.
- * (This takes care of the procedure case, as well.)
+ * (This takes care of procedures with no output parameters, as well.)
*/
if (rettype == VOIDOID)
return false;
@@ -1780,8 +1782,13 @@ check_sql_fn_retval(List *queryTreeLists,
* or not the record type really matches. For the moment we rely on
* runtime type checking to catch any discrepancy, but it'd be nice to
* do better at parse time.
+ *
+ * We must *not* do this for a procedure, however. Procedures with
+ * output parameter(s) have rettype RECORD, and the CALL code expects
+ * to get results corresponding to the list of output parameters, even
+ * when there's just one parameter that's composite.
*/
- if (tlistlen == 1)
+ if (tlistlen == 1 && prokind != PROKIND_PROCEDURE)
{
TargetEntry *tle = (TargetEntry *) linitial(tlist);