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

Function pg_get_function_sqlbody

src/backend/utils/adt/ruleutils.c:3488–3515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3486}
3487
3488Datum
3489pg_get_function_sqlbody(PG_FUNCTION_ARGS)
3490{
3491 Oid funcid = PG_GETARG_OID(0);
3492 StringInfoData buf;
3493 HeapTuple proctup;
3494 bool isnull;
3495
3496 initStringInfo(&buf);
3497
3498 /* Look up the function */
3499 proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
3500 if (!HeapTupleIsValid(proctup))
3501 PG_RETURN_NULL();
3502
3503 (void) SysCacheGetAttr(PROCOID, proctup, Anum_pg_proc_prosqlbody, &isnull);
3504 if (isnull)
3505 {
3506 ReleaseSysCache(proctup);
3507 PG_RETURN_NULL();
3508 }
3509
3510 print_function_sqlbody(&buf, proctup);
3511
3512 ReleaseSysCache(proctup);
3513
3514 PG_RETURN_TEXT_P(cstring_to_text(buf.data));
3515}
3516
3517
3518/*

Callers

nothing calls this directly

Calls 7

initStringInfoFunction · 0.85
SearchSysCache1Function · 0.85
ObjectIdGetDatumFunction · 0.85
SysCacheGetAttrFunction · 0.85
ReleaseSysCacheFunction · 0.85
print_function_sqlbodyFunction · 0.85
cstring_to_textFunction · 0.85

Tested by

no test coverage detected