262 hs.accum = key.roleid;
277 return a.roleid ==
b.roleid &&
278 strcmp(
a.searchPath,
b.searchPath) == 0;
281#define SH_PREFIX nsphash
282#define SH_ELEMENT_TYPE SearchPathCacheEntry
283#define SH_KEY_TYPE SearchPathCacheKey
285#define SH_HASH_KEY(tb, key) spcachekey_hash(key)
286#define SH_EQUAL(tb, a, b) spcachekey_equal(a, b)
287#define SH_SCOPE static inline
298#define SPCACHE_RESET_THRESHOLD 256
327 "search_path processing cache",
463 errmsg(
"cross-database references are not implemented: \"%s.%s.%s\"",
520 errmsg(
"temporary tables cannot specify a schema name")));
601 errmsg(
"could not obtain lock on relation \"%s.%s\"",
606 errmsg(
"could not obtain lock on relation \"%s\"",
634 errmsg(
"relation \"%s.%s\" does not exist",
639 errmsg(
"relation \"%s\" does not exist",
667 errmsg(
"cross-database references are not implemented: \"%s.%s.%s\"",
705 errmsg(
"no schema has been selected to create in")));
759 errmsg(
"cross-database references are not implemented: \"%s.%s.%s\"",
857 errmsg(
"cannot create relations in temporary schemas of other sessions")));
861 errmsg(
"cannot create temporary relation in non-temporary schema")));
870 errmsg(
"cannot create relations in temporary schemas of other sessions")));
876 errmsg(
"only temporary relations may be created in temporary schemas")));
941 elog(
ERROR,
"cache lookup failed for relation %u", relid);
952 relnamespace =
relform->relnamespace;
1068 elog(
ERROR,
"cache lookup failed for type %u", typid);
1251 int *argnumbers =
NULL;
1306 elog(
ERROR,
"proallargtypes is not a 1-D Oid array or it contains nulls");
1312 if (argnames !=
NIL)
1659 (*argnumbers)[
ap] =
ap;
1664 foreach(
lc, argnames)
1666 char *argname = (
char *)
lfirst(
lc);
1687 (*argnumbers)[
ap] =
pp;
1724 (*argnumbers)[
ap++] =
pp;
1770 elog(
ERROR,
"cache lookup failed for function %u", funcid);
1801 nargs,
NIL,
false,
false,
false,
false,
1807 nargs *
sizeof(
Oid)) == 0)
1810 visible = (
clist->oid == funcid);
1993#define SPACE_PER_OP MAXALIGN(offsetof(struct _FuncCandidateList, args) + \
2007 if (oprkind &&
operform->oprkind != oprkind)
2605 elog(
ERROR,
"cache lookup failed for conversion %u", conid);
2688 errmsg(
"statistics object \"%s\" does not exist",
2728 elog(
ERROR,
"cache lookup failed for statistics object %u",
stxid);
2833 errmsg(
"text search parser \"%s\" does not exist",
2873 elog(
ERROR,
"cache lookup failed for text search parser %u", prsId);
2978 errmsg(
"text search dictionary \"%s\" does not exist",
3018 elog(
ERROR,
"cache lookup failed for text search dictionary %u",
3124 errmsg(
"text search template \"%s\" does not exist",
3164 elog(
ERROR,
"cache lookup failed for text search template %u",
tmplId);
3269 errmsg(
"text search configuration \"%s\" does not exist",
3309 elog(
ERROR,
"cache lookup failed for text search configuration %u",
3378 char *schemaname =
NULL;
3379 char *objname =
NULL;
3401 errmsg(
"cross-database references are not implemented: %s",
3407 errmsg(
"improper qualified name (too many dotted names): %s",
3430 if (
strcmp(nspname,
"pg_temp") == 0)
3463 if (
strcmp(nspname,
"pg_temp") == 0)
3506 if (
strcmp(nspname,
"pg_temp") == 0)
3537 errmsg(
"cannot move objects into or out of temporary schemas")));
3543 errmsg(
"cannot move objects into or out of TOAST schema")));
3570 if (
strcmp(schemaname,
"pg_temp") == 0)
3594 errmsg(
"no schema has been selected to create in")));
3616 errmsg(
"schema \"%s\" does not exist", nspname)));
3647 errmsg(
"improper relation name (too many dotted names): %s",
3685 elog(
ERROR,
"unexpected node type in name list: %d",
3768 result = (
strncmp(nspname,
"pg_temp_", 8) == 0) ||
3769 (
strncmp(nspname,
"pg_toast_temp_", 14) == 0);
3847 if (
strncmp(nspname,
"pg_temp_", 8) == 0)
3848 result =
atoi(nspname + 8);
3849 else if (
strncmp(nspname,
"pg_toast_temp_", 14) == 0)
3850 result =
atoi(nspname + 14);
4088 errmsg(
"collation \"%s\" for encoding \"%s\" does not exist",
4100 char *conversion_name;
4143 errmsg(
"conversion \"%s\" does not exist",
4205 *temp_missing =
false;
4239 *temp_missing =
true;
4275 foreach(
lc, oidlist)
4291 if (finalPath ==
NIL)
4484 errmsg(
"permission denied to create temporary tables in database \"%s\"",
4500 errmsg(
"cannot create temporary tables during recovery")));
4506 errmsg(
"cannot create temporary tables during a parallel operation")));
4682 object.objectId = tempNamespaceId;
4683 object.objectSubId = 0;
4732 const char *searchPath = *
newval;
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
#define DatumGetArrayTypeP(X)
#define InvalidSubTransactionId
#define Assert(condition)
#define OidIsValid(objectId)
void performDeletion(const ObjectAddress *object, DropBehavior behavior, int flags)
#define PERFORM_DELETION_SKIP_EXTENSIONS
#define PERFORM_DELETION_QUIETLY
#define PERFORM_DELETION_SKIP_ORIGINAL
#define PERFORM_DELETION_INTERNAL
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
bool is_encoding_supported_by_icu(int encoding)
bool equal(const void *a, const void *b)
#define palloc_object(type)
#define palloc0_object(type)
#define PG_RETURN_BOOL(x)
int get_func_arg_info(HeapTuple procTup, Oid **p_argtypes, char ***p_argnames, char **p_argmodes)
#define GUC_check_errdetail
static size_t fasthash_accum_cstring(fasthash_state *hs, const char *str)
static uint32 fasthash_final32(fasthash_state *hs, uint64 tweak)
static void fasthash_combine(fasthash_state *hs)
static void fasthash_init(fasthash_state *hs, uint64 seed)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
#define IsParallelWorker()
void AcceptInvalidationMessages(void)
void CacheRegisterSyscacheCallback(SysCacheIdentifier cacheid, SyscacheCallbackFunction func, Datum arg)
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
List * lcons_oid(Oid datum, List *list)
List * list_delete_first(List *list)
List * list_copy(const List *oldlist)
List * lappend_oid(List *list, Oid datum)
void list_free(List *list)
bool list_member_oid(const List *list, Oid datum)
bool ConditionalLockRelationOid(Oid relid, LOCKMODE lockmode)
void UnlockRelationOid(Oid relid, LOCKMODE lockmode)
void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
void LockRelationOid(Oid relid, LOCKMODE lockmode)
void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
char * get_database_name(Oid dbid)
char get_rel_relkind(Oid relid)
char * get_namespace_name(Oid nspid)
Oid get_relname_relid(const char *relname, Oid relnamespace)
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
int GetDatabaseEncoding(void)
const char * GetDatabaseEncodingName(void)
char * MemoryContextStrdup(MemoryContext context, const char *string)
void MemoryContextReset(MemoryContext context)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext TopMemoryContext
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define IsBootstrapProcessingMode()
static const SearchPathCacheEntry * cachedNamespacePath(const char *searchPath, Oid roleid)
Oid RangeVarGetAndCheckCreationNamespace(RangeVar *relation, LOCKMODE lockmode, Oid *existing_relation_id)
Oid OpclassnameGetOpcid(Oid amid, const char *opcname)
static bool CollationIsVisibleExt(Oid collid, bool *is_missing)
bool isTempOrTempToastNamespace(Oid namespaceId)
void ResetTempTableNamespace(void)
static bool baseTempCreationPending
Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding)
Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
char * NameListToString(const List *names)
Oid LookupExplicitNamespace(const char *nspname, bool missing_ok)
static SearchPathCacheEntry * spcache_lookup(const char *searchPath, Oid roleid)
Datum pg_is_other_temp_schema(PG_FUNCTION_ARGS)
bool TSTemplateIsVisible(Oid tmplId)
Oid QualifiedNameGetCreationNamespace(const List *names, char **objname_p)
bool OpfamilyIsVisible(Oid opfid)
bool CollationIsVisible(Oid collid)
static Oid baseCreationNamespace
bool TypeIsVisible(Oid typid)
bool isOtherTempNamespace(Oid namespaceId)
static MemoryContext SearchPathCacheContext
static bool searchPathCacheValid
static Oid lookup_collation(const char *collname, Oid collnamespace, int32 encoding)
Oid CollationGetCollid(const char *collname)
void assign_search_path(const char *newval, void *extra)
static Oid activeCreationNamespace
bool isTempNamespace(Oid namespaceId)
bool isAnyTempNamespace(Oid namespaceId)
Datum pg_operator_is_visible(PG_FUNCTION_ARGS)
static List * activeSearchPath
bool ConversionIsVisible(Oid conid)
static bool baseSearchPathValid
static SubTransactionId myTempNamespaceSubID
Oid get_statistics_object_oid(List *names, bool missing_ok)
Oid LookupCreationNamespace(const char *nspname)
void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid)
static Oid myTempToastNamespace
Datum pg_collation_is_visible(PG_FUNCTION_ARGS)
Oid get_collation_oid(List *collname, bool missing_ok)
void DeconstructQualifiedName(const List *names, char **nspname_p, char **objname_p)
Datum pg_function_is_visible(PG_FUNCTION_ARGS)
static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames, bool include_out_arguments, int pronargs, int **argnumbers, int *fgc_flags)
Datum pg_type_is_visible(PG_FUNCTION_ARGS)
static bool OpclassIsVisibleExt(Oid opcid, bool *is_missing)
static bool RelationIsVisibleExt(Oid relid, bool *is_missing)
List * fetch_search_path(bool includeImplicit)
static bool FunctionIsVisibleExt(Oid funcid, bool *is_missing)
FuncCandidateList OpernameGetCandidates(List *names, char oprkind, bool missing_schema_ok, int *fgc_flags)
Datum pg_opclass_is_visible(PG_FUNCTION_ARGS)
Oid get_namespace_oid(const char *nspname, bool missing_ok)
static SearchPathCacheEntry * spcache_insert(const char *searchPath, Oid roleid)
SearchPathMatcher * GetSearchPathMatcher(MemoryContext context)
Oid TypenameGetTypidExtended(const char *typname, bool temp_ok)
static bool TSDictionaryIsVisibleExt(Oid dictId, bool *is_missing)
char * NameListToQuotedString(const List *names)
Oid RangeVarGetCreationNamespace(const RangeVar *newRelation)
bool RelationIsVisible(Oid relid)
static List * preprocessNamespacePath(const char *searchPath, Oid roleid, bool *temp_missing)
Datum pg_ts_config_is_visible(PG_FUNCTION_ARGS)
static void spcache_init(void)
Datum pg_opfamily_is_visible(PG_FUNCTION_ARGS)
bool OpclassIsVisible(Oid opcid)
Oid ConversionGetConid(const char *conname)
void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
static List * finalNamespacePath(List *oidlist, Oid *firstNS)
TempNamespaceStatus checkTempNamespaceStatus(Oid namespaceId)
Datum pg_conversion_is_visible(PG_FUNCTION_ARGS)
void CheckSetNamespace(Oid oldNspOid, Oid nspOid)
static SearchPathCacheEntry * LastSearchPathCacheEntry
void GetTempNamespaceState(Oid *tempNamespaceId, Oid *tempToastNamespaceId)
void InitializeSearchPath(void)
static bool TSParserIsVisibleExt(Oid prsId, bool *is_missing)
static bool StatisticsObjIsVisibleExt(Oid stxid, bool *is_missing)
bool OperatorIsVisible(Oid oprid)
static bool TSTemplateIsVisibleExt(Oid tmplId, bool *is_missing)
char * namespace_search_path
bool TSParserIsVisible(Oid prsId)
static void RemoveTempRelations(Oid tempNamespaceId)
static void recomputeNamespacePath(void)
FuncCandidateList FuncnameGetCandidates(List *names, int nargs, List *argnames, bool expand_variadic, bool expand_defaults, bool include_out_arguments, bool missing_ok, int *fgc_flags)
static Oid myTempNamespace
#define SPCACHE_RESET_THRESHOLD
bool SearchPathMatchesCurrentEnvironment(SearchPathMatcher *path)
Datum pg_statistics_obj_is_visible(PG_FUNCTION_ARGS)
static nsphash_hash * SearchPathCache
static bool ConversionIsVisibleExt(Oid conid, bool *is_missing)
static bool activeTempCreationPending
Oid get_conversion_oid(List *conname, bool missing_ok)
static void InitTempTableNamespace(void)
bool FunctionIsVisible(Oid funcid)
Oid get_ts_dict_oid(List *names, bool missing_ok)
static bool OperatorIsVisibleExt(Oid oprid, bool *is_missing)
Oid get_ts_parser_oid(List *names, bool missing_ok)
Datum pg_ts_template_is_visible(PG_FUNCTION_ARGS)
static bool TSConfigIsVisibleExt(Oid cfgid, bool *is_missing)
static bool TypeIsVisibleExt(Oid typid, bool *is_missing)
SearchPathMatcher * CopySearchPathMatcher(SearchPathMatcher *path)
static void AccessTempTableNamespace(bool force)
void SetTempNamespaceState(Oid tempNamespaceId, Oid tempToastNamespaceId)
Oid GetTempToastNamespace(void)
static bool OpfamilyIsVisibleExt(Oid opfid, bool *is_missing)
Oid OpfamilynameGetOpfid(Oid amid, const char *opfname)
RangeVar * makeRangeVarFromNameList(const List *names)
void AtEOXact_Namespace(bool isCommit, bool parallel)
Oid get_ts_config_oid(List *names, bool missing_ok)
static bool spcachekey_equal(SearchPathCacheKey a, SearchPathCacheKey b)
bool check_search_path(char **newval, void **extra, GucSource source)
Oid LookupNamespaceNoError(const char *nspname)
ProcNumber GetTempNamespaceProcNumber(Oid namespaceId)
static void RemoveTempRelationsCallback(int code, Datum arg)
Oid TypenameGetTypid(const char *typname)
int fetch_search_path_array(Oid *sarray, int sarray_len)
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
static uint32 spcachekey_hash(SearchPathCacheKey key)
static uint64 activePathGeneration
bool TSConfigIsVisible(Oid cfgid)
bool StatisticsObjIsVisible(Oid stxid)
Datum pg_ts_dict_is_visible(PG_FUNCTION_ARGS)
Oid RelnameGetRelid(const char *relname)
static List * baseSearchPath
Datum pg_my_temp_schema(PG_FUNCTION_ARGS)
Datum pg_ts_parser_is_visible(PG_FUNCTION_ARGS)
static void InvalidationCallback(Datum arg, SysCacheIdentifier cacheid, uint32 hashvalue)
bool TSDictionaryIsVisible(Oid dictId)
Datum pg_table_is_visible(PG_FUNCTION_ARGS)
bool isTempToastNamespace(Oid namespaceId)
Oid get_ts_template_oid(List *names, bool missing_ok)
void(* RangeVarGetRelidCallback)(const RangeVar *relation, Oid relId, Oid oldRelId, void *callback_arg)
#define FGC_ARGNAMES_VALID
#define FGC_ARGNAMES_MATCH
@ TEMP_NAMESPACE_NOT_TEMP
#define FGC_ARGCOUNT_MATCH
struct _FuncCandidateList * FuncCandidateList
#define FGC_SCHEMA_EXISTS
#define FGC_ARGNAMES_NONDUP
#define IsA(nodeptr, _type_)
object_access_hook_type object_access_hook
#define InvokeNamespaceSearchHook(objectId, ereport_on_violation)
ObjectType get_relkind_objtype(char relkind)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
END_CATALOG_STRUCT typedef FormData_pg_authid * Form_pg_authid
FormData_pg_class * Form_pg_class
END_CATALOG_STRUCT typedef FormData_pg_collation * Form_pg_collation
Oid FindDefaultConversion(Oid name_space, int32 for_encoding, int32 to_encoding)
END_CATALOG_STRUCT typedef FormData_pg_conversion * Form_pg_conversion
static int list_length(const List *l)
#define list_make1_oid(x1)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
Oid NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp)
END_CATALOG_STRUCT typedef FormData_pg_opclass * Form_pg_opclass
END_CATALOG_STRUCT typedef FormData_pg_operator * Form_pg_operator
END_CATALOG_STRUCT typedef FormData_pg_opfamily * Form_pg_opfamily
END_CATALOG_STRUCT typedef FormData_pg_proc * Form_pg_proc
static rewind_source * source
END_CATALOG_STRUCT typedef FormData_pg_statistic_ext * Form_pg_statistic_ext
END_CATALOG_STRUCT typedef FormData_pg_ts_config * Form_pg_ts_config
END_CATALOG_STRUCT typedef FormData_pg_ts_dict * Form_pg_ts_dict
END_CATALOG_STRUCT typedef FormData_pg_ts_parser * Form_pg_ts_parser
END_CATALOG_STRUCT typedef FormData_pg_ts_template * Form_pg_ts_template
END_CATALOG_STRUCT typedef FormData_pg_type * Form_pg_type
#define ERRCODE_UNDEFINED_TABLE
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
PGPROC * ProcNumberGetProc(ProcNumber procNumber)
#define INVALID_PROC_NUMBER
const char * quote_identifier(const char *ident)
uint64 SharedInvalidMessageCounter
Snapshot GetTransactionSnapshot(void)
void PushActiveSnapshot(Snapshot snapshot)
void PopActiveSnapshot(void)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
struct _FuncCandidateList * next
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache3(SysCacheIdentifier cacheId, Datum key1, Datum key2, Datum key3)
HeapTuple SearchSysCache4(SysCacheIdentifier cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Datum SysCacheGetAttr(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
#define SearchSysCacheList3(cacheId, key1, key2, key3)
#define ReleaseSysCacheList(x)
#define SearchSysCacheExists2(cacheId, key1, key2)
#define SearchSysCacheList1(cacheId, key1)
#define GetSysCacheOid3(cacheId, oidcol, key1, key2, key3)
#define GetSysCacheOid1(cacheId, oidcol, key1)
#define GetSysCacheOid2(cacheId, oidcol, key1, key2)
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
String * makeString(char *str)
bool SplitIdentifierString(char *rawstring, char separator, List **namelist)
SubTransactionId GetCurrentSubTransactionId(void)
void CommandCounterIncrement(void)
void StartTransactionCommand(void)
void CommitTransactionCommand(void)
void AbortOutOfAnyTransaction(void)
#define XACT_FLAGS_ACCESSEDTEMPNAMESPACE
bool RecoveryInProgress(void)