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

Function getRelationIdentity

src/backend/catalog/objectaddress.c:6453–6482  ·  view source on GitHub ↗

* Append the relation identity (quoted qualified name) to the given * StringInfo. */

Source from the content-addressed store, hash-verified

6451 * StringInfo.
6452 */
6453static void
6454getRelationIdentity(StringInfo buffer, Oid relid, List **object,
6455 bool missing_ok)
6456{
6457 HeapTuple relTup;
6458 Form_pg_class relForm;
6459 char *schema;
6460
6461 relTup = SearchSysCache1(RELOID,
6462 ObjectIdGetDatum(relid));
6463 if (!HeapTupleIsValid(relTup))
6464 {
6465 if (!missing_ok)
6466 elog(ERROR, "cache lookup failed for relation %u", relid);
6467
6468 if (object)
6469 *object = NIL;
6470 return;
6471 }
6472 relForm = (Form_pg_class) GETSTRUCT(relTup);
6473
6474 schema = get_namespace_name_or_temp(relForm->relnamespace);
6475 appendStringInfoString(buffer,
6476 quote_qualified_identifier(schema,
6477 NameStr(relForm->relname)));
6478 if (object)
6479 *object = list_make2(schema, pstrdup(NameStr(relForm->relname)));
6480
6481 ReleaseSysCache(relTup);
6482}
6483
6484/*
6485 * Auxiliary function to build a TEXT array out of a list of C-strings.

Callers 1

getObjectIdentityPartsFunction · 0.85

Calls 7

SearchSysCache1Function · 0.85
ObjectIdGetDatumFunction · 0.85
appendStringInfoStringFunction · 0.85
ReleaseSysCacheFunction · 0.85
pstrdupFunction · 0.50

Tested by

no test coverage detected