Commit 112caf90 authored by Tom Lane's avatar Tom Lane

Finish reverting commit 0a52d378.

Apply the solution adopted in commit dcb7d3ca (ie, explicitly
don't call memcmp for a zero-length comparison) to func_get_detail()
as well, removing one other place where we were passing an
uninitialized array to a parse_func.c entry point.

Discussion: https://postgr.es/m/MN2PR18MB2927F24692485D754794F01BE3740@MN2PR18MB2927.namprd18.prod.outlook.com
Discussion: https://postgr.es/m/MN2PR18MB2927F6873DF2774A505AC298E3740@MN2PR18MB2927.namprd18.prod.outlook.com
parent c5e8ea97
...@@ -1397,9 +1397,6 @@ func_get_detail(List *funcname, ...@@ -1397,9 +1397,6 @@ func_get_detail(List *funcname,
FuncCandidateList raw_candidates; FuncCandidateList raw_candidates;
FuncCandidateList best_candidate; FuncCandidateList best_candidate;
/* Passing NULL for argtypes is no longer allowed */
Assert(argtypes);
/* initialize output arguments to silence compiler warnings */ /* initialize output arguments to silence compiler warnings */
*funcid = InvalidOid; *funcid = InvalidOid;
*rettype = InvalidOid; *rettype = InvalidOid;
...@@ -1423,7 +1420,9 @@ func_get_detail(List *funcname, ...@@ -1423,7 +1420,9 @@ func_get_detail(List *funcname,
best_candidate != NULL; best_candidate != NULL;
best_candidate = best_candidate->next) best_candidate = best_candidate->next)
{ {
if (memcmp(argtypes, best_candidate->args, nargs * sizeof(Oid)) == 0) /* if nargs==0, argtypes can be null; don't pass that to memcmp */
if (nargs == 0 ||
memcmp(argtypes, best_candidate->args, nargs * sizeof(Oid)) == 0)
break; break;
} }
......
...@@ -833,7 +833,6 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) ...@@ -833,7 +833,6 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
char *tgname; char *tgname;
char *tgoldtable; char *tgoldtable;
char *tgnewtable; char *tgnewtable;
Oid argtypes[1]; /* dummy */
Datum value; Datum value;
bool isnull; bool isnull;
...@@ -1045,7 +1044,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) ...@@ -1045,7 +1044,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
appendStringInfo(&buf, "EXECUTE FUNCTION %s(", appendStringInfo(&buf, "EXECUTE FUNCTION %s(",
generate_function_name(trigrec->tgfoid, 0, generate_function_name(trigrec->tgfoid, 0,
NIL, argtypes, NIL, NULL,
false, NULL, EXPR_KIND_NONE)); false, NULL, EXPR_KIND_NONE));
if (trigrec->tgnargs > 0) if (trigrec->tgnargs > 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment