* LookupExplicitNamespace * Process an explicitly-specified schema name: look up the schema * and verify we have USAGE (lookup) rights in it. * * Returns the namespace OID */
| 2967 | * Returns the namespace OID |
| 2968 | */ |
| 2969 | Oid |
| 2970 | LookupExplicitNamespace(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 |
no test coverage detected