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

Function funcname_signature_string

src/backend/parser/parse_func.c:2047–2078  ·  view source on GitHub ↗

* funcname_signature_string * Build a string representing a function name, including arg types. * The result is something like "foo(integer)". * * If argnames isn't NIL, it is a list of C strings representing the actual * arg names for the last N arguments. This must be considered part of the * function signature too, when dealing with named-notation function calls. * * This is typicall

Source from the content-addressed store, hash-verified

2045 * messages.
2046 */
2047const char *
2048funcname_signature_string(const char *funcname, int nargs,
2049 List *argnames, const Oid *argtypes)
2050{
2051 StringInfoData argbuf;
2052 int numposargs;
2053 ListCell *lc;
2054 int i;
2055
2056 initStringInfo(&argbuf);
2057
2058 appendStringInfo(&argbuf, "%s(", funcname);
2059
2060 numposargs = nargs - list_length(argnames);
2061 lc = list_head(argnames);
2062
2063 for (i = 0; i < nargs; i++)
2064 {
2065 if (i)
2066 appendStringInfoString(&argbuf, ", ");
2067 if (i >= numposargs)
2068 {
2069 appendStringInfo(&argbuf, "%s => ", (char *) lfirst(lc));
2070 lc = lnext(argnames, lc);
2071 }
2072 appendStringInfoString(&argbuf, format_type_be(argtypes[i]));
2073 }
2074
2075 appendStringInfoChar(&argbuf, ')');
2076
2077 return argbuf.data; /* return palloc'd string buffer */
2078}
2079
2080/*
2081 * func_signature_string

Callers 2

func_signature_stringFunction · 0.85

Calls 8

initStringInfoFunction · 0.85
appendStringInfoFunction · 0.85
list_lengthFunction · 0.85
list_headFunction · 0.85
appendStringInfoStringFunction · 0.85
lnextFunction · 0.85
format_type_beFunction · 0.85
appendStringInfoCharFunction · 0.85

Tested by

no test coverage detected