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

Function LookupExplicitNamespace

src/backend/catalog/namespace.c:2969–3000  ·  view source on GitHub ↗

* LookupExplicitNamespace * Process an explicitly-specified schema name: look up the schema * and verify we have USAGE (lookup) rights in it. * * Returns the namespace OID */

Source from the content-addressed store, hash-verified

2967 * Returns the namespace OID
2968 */
2969Oid
2970LookupExplicitNamespace(const char *nspname, bool missing_ok)
2971{
2972 Oid namespaceId;
2973 AclResult aclresult;
2974
2975 /* check for pg_temp alias */
2976 if (strcmp(nspname, "pg_temp") == 0)
2977 {
2978 if (TempNamespaceValid(true))
2979 return myTempNamespace;
2980
2981 /*
2982 * Since this is used only for looking up existing objects, there is
2983 * no point in trying to initialize the temp namespace here; and doing
2984 * so might create problems for some callers --- just fall through.
2985 */
2986 }
2987
2988 namespaceId = get_namespace_oid(nspname, missing_ok);
2989 if (missing_ok && !OidIsValid(namespaceId))
2990 return InvalidOid;
2991
2992 aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(), ACL_USAGE);
2993 if (aclresult != ACLCHECK_OK)
2994 aclcheck_error(aclresult, OBJECT_SCHEMA,
2995 nspname);
2996 /* Schema search hook for this lookup */
2997 InvokeNamespaceSearchHook(namespaceId, true);
2998
2999 return namespaceId;
3000}
3001
3002/*
3003 * LookupCreationNamespace

Callers 15

schema_to_xmlFunction · 0.85
ResolveOpClassFunction · 0.85
AfterTriggerSetStateFunction · 0.85
OpFamilyCacheLookupFunction · 0.85
OpClassCacheLookupFunction · 0.85
make_oper_cache_keyFunction · 0.85
LookupTypeNameExtendedFunction · 0.85
objectsInSchemaToOidsFunction · 0.85
RangeVarGetRelidExtendedFunction · 0.85

Calls 5

TempNamespaceValidFunction · 0.85
get_namespace_oidFunction · 0.85
pg_namespace_aclcheckFunction · 0.85
GetUserIdFunction · 0.85
aclcheck_errorFunction · 0.85

Tested by

no test coverage detected