* appendFunctionName * Deparses function name from given function oid. */
| 3505 | * Deparses function name from given function oid. |
| 3506 | */ |
| 3507 | static void |
| 3508 | appendFunctionName(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. |
no test coverage detected