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.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 39580f7d577..32668f85a1d 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -245,8 +245,7 @@ prepare_sql_fn_parse_info(HeapTuple procedureTuple,
if (isNull)
proargmodes = PointerGetDatum(NULL); /* just to be sure */
- n_arg_names = get_func_input_arg_names(procedureStruct->prokind,
- proargnames, proargmodes,
+ n_arg_names = get_func_input_arg_names(proargnames, proargmodes,
&pinfo->argnames);
/* Paranoia: ignore the result if too few array entries */
@@ -1536,7 +1535,7 @@ check_sql_fn_statements(List *queryTreeLists)
Query *query = lfirst_node(Query, lc2);
/*
- * Disallow procedures with output arguments. The current
+ * Disallow calling procedures with output arguments. The current
* implementation would just throw the output values away, unless
* the statement is the last one. Per SQL standard, we should
* assign the output values by name. By disallowing this here, we
@@ -1545,31 +1544,12 @@ check_sql_fn_statements(List *queryTreeLists)
if (query->commandType == CMD_UTILITY &&
IsA(query->utilityStmt, CallStmt))
{
- CallStmt *stmt = castNode(CallStmt, query->utilityStmt);
- HeapTuple tuple;
- int numargs;
- Oid *argtypes;
- char **argnames;
- char *argmodes;
- int i;
-
- tuple = SearchSysCache1(PROCOID,
- ObjectIdGetDatum(stmt->funcexpr->funcid));
- if (!HeapTupleIsValid(tuple))
- elog(ERROR, "cache lookup failed for function %u",
- stmt->funcexpr->funcid);
- numargs = get_func_arg_info(tuple,
- &argtypes, &argnames, &argmodes);
- ReleaseSysCache(tuple);
-
- for (i = 0; i < numargs; i++)
- {
- if (argmodes && (argmodes[i] == PROARGMODE_INOUT ||
- argmodes[i] == PROARGMODE_OUT))
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("calling procedures with output arguments is not supported in SQL functions")));
- }
+ CallStmt *stmt = (CallStmt *) query->utilityStmt;
+
+ if (stmt->outargs != NIL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("calling procedures with output arguments is not supported in SQL functions")));
}
}
}