260 hs.accum = key.roleid;
275 return a.roleid ==
b.roleid &&
276 strcmp(
a.searchPath,
b.searchPath) == 0;
279#define SH_PREFIX nsphash
280#define SH_ELEMENT_TYPE SearchPathCacheEntry
281#define SH_KEY_TYPE SearchPathCacheKey
283#define SH_HASH_KEY(tb, key) spcachekey_hash(key)
284#define SH_EQUAL(tb, a, b) spcachekey_equal(a, b)
285#define SH_SCOPE static inline
296#define SPCACHE_RESET_THRESHOLD 256
325 "search_path processing cache",
461 errmsg(
"cross-database references are not implemented: \"%s.%s.%s\"",
518 errmsg(
"temporary tables cannot specify a schema name")));
599 errmsg(
"could not obtain lock on relation \"%s.%s\"",
604 errmsg(
"could not obtain lock on relation \"%s\"",
632 errmsg(
"relation \"%s.%s\" does not exist",
637 errmsg(
"relation \"%s\" does not exist",
665 errmsg(
"cross-database references are not implemented: \"%s.%s.%s\"",
703 errmsg(
"no schema has been selected to create in")));
757 errmsg(
"cross-database references are not implemented: \"%s.%s.%s\"",
855 errmsg(
"cannot create relations in temporary schemas of other sessions")));
859 errmsg(
"cannot create temporary relation in non-temporary schema")));
868 errmsg(
"cannot create relations in temporary schemas of other sessions")));
874 errmsg(
"only temporary relations may be created in temporary schemas")));
939 elog(
ERROR,
"cache lookup failed for relation %u", relid);
950 relnamespace =
relform->relnamespace;
1066 elog(
ERROR,
"cache lookup failed for type %u", typid);
1249 int *argnumbers =
NULL;
1304 elog(
ERROR,
"proallargtypes is not a 1-D Oid array or it contains nulls");
1310 if (argnames !=
NIL)
1657 (*argnumbers)[
ap] =
ap;
1662 foreach(
lc, argnames)
1664 char *argname = (
char *)
lfirst(
lc);
1685 (*argnumbers)[
ap] =
pp;
1722 (*argnumbers)[
ap++] =
pp;
1768 elog(
ERROR,
"cache lookup failed for function %u", funcid);
1799 nargs,
NIL,
false,
false,
false,
false,
1805 nargs *
sizeof(
Oid)) == 0)
1808 visible = (
clist->oid == funcid);
1991#define SPACE_PER_OP MAXALIGN(offsetof(struct _FuncCandidateList, args) + \
2005 if (oprkind &&
operform->oprkind != oprkind)
2603 elog(
ERROR,
"cache lookup failed for conversion %u", conid);
2686 errmsg(
"statistics object \"%s\" does not exist",
2726 elog(
ERROR,
"cache lookup failed for statistics object %u",
stxid);
2831 errmsg(
"text search parser \"%s\" does not exist",
2871 elog(
ERROR,
"cache lookup failed for text search parser %u", prsId);
2976 errmsg(
"text search dictionary \"%s\" does not exist",
3016 elog(
ERROR,
"cache lookup failed for text search dictionary %u",
3122 errmsg(
"text search template \"%s\" does not exist",
3162 elog(
ERROR,
"cache lookup failed for text search template %u",
tmplId);
3267 errmsg(
"text search configuration \"%s\" does not exist",
3307 elog(
ERROR,
"cache lookup failed for text search configuration %u",
3376 char *schemaname =
NULL;
3377 char *objname =
NULL;
3399 errmsg(
"cross-database references are not implemented: %s",
3405 errmsg(
"improper qualified name (too many dotted names): %s",
3428 if (
strcmp(nspname,
"pg_temp") == 0)
3461 if (
strcmp(nspname,
"pg_temp") == 0)
3504 if (
strcmp(nspname,
"pg_temp") == 0)
3535 errmsg(
"cannot move objects into or out of temporary schemas")));
3541 errmsg(
"cannot move objects into or out of TOAST schema")));
3568 if (
strcmp(schemaname,
"pg_temp") == 0)
3592 errmsg(
"no schema has been selected to create in")));
3614 errmsg(
"schema \"%s\" does not exist", nspname)));
3645 errmsg(
"improper relation name (too many dotted names): %s",
3683 elog(
ERROR,
"unexpected node type in name list: %d",
3766 result = (
strncmp(nspname,
"pg_temp_", 8) == 0) ||
3767 (
strncmp(nspname,
"pg_toast_temp_", 14) == 0);
3845 if (
strncmp(nspname,
"pg_temp_", 8) == 0)
3846 result =
atoi(nspname + 8);
3847 else if (
strncmp(nspname,
"pg_toast_temp_", 14) == 0)
3848 result =
atoi(nspname + 14);
4086 errmsg(
"collation \"%s\" for encoding \"%s\" does not exist",
4098 char *conversion_name;
4141 errmsg(
"conversion \"%s\" does not exist",
4203 *temp_missing =
false;
4237 *temp_missing =
true;
4273 foreach(
lc, oidlist)
4289 if (finalPath ==
NIL)
4482 errmsg(
"permission denied to create temporary tables in database \"%s\"",
4498 errmsg(
"cannot create temporary tables during recovery")));
4504 errmsg(
"cannot create temporary tables during a parallel operation")));
4680 object.objectId = tempNamespaceId;
4681 object.objectSubId = 0;
4730 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(int 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)
static void InvalidationCallback(Datum arg, int cacheid, uint32 hashvalue)
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)
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)
FormData_pg_authid * Form_pg_authid
FormData_pg_class * Form_pg_class
FormData_pg_collation * Form_pg_collation
Oid FindDefaultConversion(Oid name_space, int32 for_encoding, int32 to_encoding)
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)
FormData_pg_opclass * Form_pg_opclass
FormData_pg_operator * Form_pg_operator
FormData_pg_opfamily * Form_pg_opfamily
FormData_pg_proc * Form_pg_proc
static rewind_source * source
FormData_pg_statistic_ext * Form_pg_statistic_ext
FormData_pg_ts_config * Form_pg_ts_config
FormData_pg_ts_dict * Form_pg_ts_dict
FormData_pg_ts_parser * Form_pg_ts_parser
FormData_pg_ts_template * Form_pg_ts_template
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 SearchSysCache1(int cacheId, Datum key1)
HeapTuple SearchSysCache3(int cacheId, Datum key1, Datum key2, Datum key3)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
HeapTuple SearchSysCache4(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
#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)