MCPcopy Create free account
hub / github.com/apache/cloudberry / LookupFuncName

Function LookupFuncName

src/backend/parser/parse_func.c:2198–2243  ·  view source on GitHub ↗

* LookupFuncName * * Given a possibly-qualified function name and optionally a set of argument * types, look up the function. Pass nargs == -1 to indicate that the number * and types of the arguments are unspecified (this is NOT the same as * specifying that there are no arguments). * * If the function name is not schema-qualified, it is sought in the current * namespace search path. *

Source from the content-addressed store, hash-verified

2196 * aggregates or window functions here.)
2197 */
2198Oid
2199LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool missing_ok)
2200{
2201 Oid funcoid;
2202 FuncLookupError lookupError;
2203
2204 funcoid = LookupFuncNameInternal(OBJECT_FUNCTION,
2205 funcname, nargs, argtypes,
2206 false, missing_ok,
2207 &lookupError);
2208
2209 if (OidIsValid(funcoid))
2210 return funcoid;
2211
2212 switch (lookupError)
2213 {
2214 case FUNCLOOKUP_NOSUCHFUNC:
2215 /* Let the caller deal with it when missing_ok is true */
2216 if (missing_ok)
2217 return InvalidOid;
2218
2219 if (nargs < 0)
2220 ereport(ERROR,
2221 (errcode(ERRCODE_UNDEFINED_FUNCTION),
2222 errmsg("could not find a function named \"%s\"",
2223 NameListToString(funcname))));
2224 else
2225 ereport(ERROR,
2226 (errcode(ERRCODE_UNDEFINED_FUNCTION),
2227 errmsg("function %s does not exist",
2228 func_signature_string(funcname, nargs,
2229 NIL, argtypes))));
2230 break;
2231
2232 case FUNCLOOKUP_AMBIGUOUS:
2233 /* Raise an error regardless of missing_ok */
2234 ereport(ERROR,
2235 (errcode(ERRCODE_AMBIGUOUS_FUNCTION),
2236 errmsg("function name \"%s\" is not unique",
2237 NameListToString(funcname)),
2238 errhint("Specify the argument list to select the function unambiguously.")));
2239 break;
2240 }
2241
2242 return InvalidOid; /* Keep compiler quiet */
2243}
2244
2245/*
2246 * LookupFuncWithArgs

Callers 15

call_pltcl_start_procFunction · 0.85
CreateConversionCommandFunction · 0.85
CreateTriggerFiringOnFunction · 0.85
findTypeInputFunctionFunction · 0.85
findTypeOutputFunctionFunction · 0.85
findTypeReceiveFunctionFunction · 0.85
findTypeSendFunctionFunction · 0.85
findTypeTypmodinFunctionFunction · 0.85
findTypeAnalyzeFunctionFunction · 0.85

Calls 6

LookupFuncNameInternalFunction · 0.85
NameListToStringFunction · 0.85
func_signature_stringFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
errhintFunction · 0.50

Tested by

no test coverage detected