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

Function getObjectIdentityParts

src/backend/catalog/objectaddress.c:5082–6407  ·  view source on GitHub ↗

* As above, but more detailed. * * There are two sets of return values: the identity itself as a palloc'd * string is returned. objname and objargs, if not NULL, are output parameters * that receive lists of C-strings that are useful to give back to * get_object_address() to reconstruct the ObjectAddress. Returns NULL if * the object could not be found. */

Source from the content-addressed store, hash-verified

5080 * the object could not be found.
5081 */
5082char *
5083getObjectIdentityParts(const ObjectAddress *object,
5084 List **objname, List **objargs,
5085 bool missing_ok)
5086{
5087 StringInfoData buffer;
5088
5089 initStringInfo(&buffer);
5090
5091 /*
5092 * Make sure that both objname and objargs were passed, or none was; and
5093 * initialize them to empty lists. For objname this is useless because it
5094 * will be initialized in all cases inside the switch; but we do it anyway
5095 * so that we can test below that no branch leaves it unset.
5096 */
5097 Assert(PointerIsValid(objname) == PointerIsValid(objargs));
5098 if (objname)
5099 {
5100 *objname = NIL;
5101 *objargs = NIL;
5102 }
5103
5104 switch (getObjectClass(object))
5105 {
5106 case OCLASS_CLASS:
5107 {
5108 char *attr = NULL;
5109
5110 /*
5111 * Check for the attribute first, so as if it is missing we
5112 * can skip the entire relation description.
5113 */
5114 if (object->objectSubId != 0)
5115 {
5116 attr = get_attname(object->objectId,
5117 object->objectSubId,
5118 missing_ok);
5119
5120 if (missing_ok && attr == NULL)
5121 break;
5122 }
5123
5124 getRelationIdentity(&buffer, object->objectId, objname,
5125 missing_ok);
5126 if (objname && *objname == NIL)
5127 break;
5128
5129 if (attr)
5130 {
5131 appendStringInfo(&buffer, ".%s",
5132 quote_identifier(attr));
5133 if (objname)
5134 *objname = lappend(*objname, attr);
5135 }
5136 }
5137 break;
5138
5139 case OCLASS_PROC:

Callers 3

getObjectIdentityFunction · 0.85

Calls 15

initStringInfoFunction · 0.85
getObjectClassFunction · 0.85
get_attnameFunction · 0.85
getRelationIdentityFunction · 0.85
appendStringInfoFunction · 0.85
lappendFunction · 0.85
appendStringInfoStringFunction · 0.85
format_procedure_partsFunction · 0.85
format_type_extendedFunction · 0.85
table_openFunction · 0.85

Tested by

no test coverage detected