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

Function getObjectDescription

src/backend/catalog/objectaddress.c:3064–4300  ·  view source on GitHub ↗

* getObjectDescription: build an object description for messages * * The result is a palloc'd string. NULL is returned for an undefined * object if missing_ok is true, else an error is generated. */

Source from the content-addressed store, hash-verified

3062 * object if missing_ok is true, else an error is generated.
3063 */
3064char *
3065getObjectDescription(const ObjectAddress *object, bool missing_ok)
3066{
3067 StringInfoData buffer;
3068
3069 initStringInfo(&buffer);
3070
3071 switch (getObjectClass(object))
3072 {
3073 case OCLASS_CLASS:
3074 if (object->objectSubId == 0)
3075 getRelationDescription(&buffer, object->objectId, missing_ok);
3076 else
3077 {
3078 /* column, not whole relation */
3079 StringInfoData rel;
3080 char *attname = get_attname(object->objectId,
3081 object->objectSubId,
3082 missing_ok);
3083
3084 if (!attname)
3085 break;
3086
3087 initStringInfo(&rel);
3088 getRelationDescription(&rel, object->objectId, missing_ok);
3089 /* translator: second %s is, e.g., "table %s" */
3090 appendStringInfo(&buffer, _("column %s of %s"),
3091 attname, rel.data);
3092 pfree(rel.data);
3093 }
3094 break;
3095
3096 case OCLASS_PROC:
3097 {
3098 bits16 flags = FORMAT_PROC_INVALID_AS_NULL;
3099 char *proname = format_procedure_extended(object->objectId,
3100 flags);
3101
3102 if (proname == NULL)
3103 break;
3104
3105 appendStringInfo(&buffer, _("function %s"), proname);
3106 break;
3107 }
3108
3109 case OCLASS_TYPE:
3110 {
3111 bits16 flags = FORMAT_TYPE_INVALID_AS_NULL;
3112 char *typname = format_type_extended(object->objectId, -1,
3113 flags);
3114
3115 if (typname == NULL)
3116 break;
3117
3118 appendStringInfo(&buffer, _("type %s"), typname);
3119 break;
3120 }
3121

Callers 15

sepgsql_fmgr_hookFunction · 0.85
AlterExtensionNamespaceFunction · 0.85
ATExecAlterColumnTypeFunction · 0.85
checkSharedDependenciesFunction · 0.85
storeObjectDescriptionFunction · 0.85
shdepDropOwnedFunction · 0.85
shdepReassignOwnedFunction · 0.85
changeDependenciesOnFunction · 0.85

Calls 15

initStringInfoFunction · 0.85
getObjectClassFunction · 0.85
getRelationDescriptionFunction · 0.85
get_attnameFunction · 0.85
appendStringInfoFunction · 0.85
format_type_extendedFunction · 0.85
table_openFunction · 0.85
ScanKeyInitFunction · 0.85
ObjectIdGetDatumFunction · 0.85
systable_beginscanFunction · 0.85
systable_getnextFunction · 0.85

Tested by

no test coverage detected