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

Function appendFunctionName

contrib/postgres_fdw/deparse.c:3507–3534  ·  view source on GitHub ↗

* appendFunctionName * Deparses function name from given function oid. */

Source from the content-addressed store, hash-verified

3505 * Deparses function name from given function oid.
3506 */
3507static void
3508appendFunctionName(Oid funcid, deparse_expr_cxt *context)
3509{
3510 StringInfo buf = context->buf;
3511 HeapTuple proctup;
3512 Form_pg_proc procform;
3513 const char *proname;
3514
3515 proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
3516 if (!HeapTupleIsValid(proctup))
3517 elog(ERROR, "cache lookup failed for function %u", funcid);
3518 procform = (Form_pg_proc) GETSTRUCT(proctup);
3519
3520 /* Print schema name only if it's not pg_catalog */
3521 if (procform->pronamespace != PG_CATALOG_NAMESPACE)
3522 {
3523 const char *schemaname;
3524
3525 schemaname = get_namespace_name(procform->pronamespace);
3526 appendStringInfo(buf, "%s.", quote_identifier(schemaname));
3527 }
3528
3529 /* Always print the function name */
3530 proname = NameStr(procform->proname);
3531 appendStringInfoString(buf, quote_identifier(proname));
3532
3533 ReleaseSysCache(proctup);
3534}
3535
3536/*
3537 * Appends a sort or group clause.

Callers 2

deparseFuncExprFunction · 0.85
deparseAggrefFunction · 0.85

Calls 7

SearchSysCache1Function · 0.85
ObjectIdGetDatumFunction · 0.85
get_namespace_nameFunction · 0.85
appendStringInfoFunction · 0.85
appendStringInfoStringFunction · 0.85
ReleaseSysCacheFunction · 0.85
quote_identifierFunction · 0.50

Tested by

no test coverage detected