PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * namespace.h
4  * prototypes for functions in backend/catalog/namespace.c
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/catalog/namespace.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef NAMESPACE_H
15 #define NAMESPACE_H
17 #include "nodes/primnodes.h"
18 #include "storage/lock.h"
21 /*
22  * This structure holds a list of possible functions or operators
23  * found by namespace lookup. Each function/operator is identified
24  * by OID and by argument types; the list must be pruned by type
25  * resolution rules that are embodied in the parser, not here.
26  * See FuncnameGetCandidates's comments for more info.
27  */
28 typedef struct _FuncCandidateList
29 {
31  int pathpos; /* for internal use of namespace lookup */
32  Oid oid; /* the function or operator's OID */
33  int nargs; /* number of arg types returned */
34  int nvargs; /* number of args to become variadic array */
35  int ndargs; /* number of defaulted args */
36  int *argnumbers; /* args' positional indexes, if named call */
37  Oid args[FLEXIBLE_ARRAY_MEMBER]; /* arg types */
40 /*
41  * Structure for xxxOverrideSearchPath functions
42  */
43 typedef struct OverrideSearchPath
44 {
45  List *schemas; /* OIDs of explicitly named schemas */
46  bool addCatalog; /* implicitly prepend pg_catalog? */
47  bool addTemp; /* implicitly prepend temp schema? */
50 typedef void (*RangeVarGetRelidCallback) (const RangeVar *relation, Oid relId,
51  Oid oldRelId, void *callback_arg);
53 #define RangeVarGetRelid(relation, lockmode, missing_ok) \
54  RangeVarGetRelidExtended(relation, lockmode, missing_ok, false, NULL, NULL)
56 extern Oid RangeVarGetRelidExtended(const RangeVar *relation,
57  LOCKMODE lockmode, bool missing_ok, bool nowait,
59  void *callback_arg);
60 extern Oid RangeVarGetCreationNamespace(const RangeVar *newRelation);
62  LOCKMODE lockmode,
63  Oid *existing_relation_id);
64 extern void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid);
65 extern Oid RelnameGetRelid(const char *relname);
66 extern bool RelationIsVisible(Oid relid);
68 extern Oid TypenameGetTypid(const char *typname);
69 extern bool TypeIsVisible(Oid typid);
72  int nargs, List *argnames,
73  bool expand_variadic,
74  bool expand_defaults,
75  bool missing_ok);
76 extern bool FunctionIsVisible(Oid funcid);
78 extern Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright);
79 extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind,
80  bool missing_schema_ok);
81 extern bool OperatorIsVisible(Oid oprid);
83 extern Oid OpclassnameGetOpcid(Oid amid, const char *opcname);
84 extern bool OpclassIsVisible(Oid opcid);
86 extern Oid OpfamilynameGetOpfid(Oid amid, const char *opfname);
87 extern bool OpfamilyIsVisible(Oid opfid);
89 extern Oid CollationGetCollid(const char *collname);
90 extern bool CollationIsVisible(Oid collid);
92 extern Oid ConversionGetConid(const char *conname);
93 extern bool ConversionIsVisible(Oid conid);
95 extern Oid get_statistics_object_oid(List *names, bool missing_ok);
96 extern bool StatisticsObjIsVisible(Oid stxid);
98 extern Oid get_ts_parser_oid(List *names, bool missing_ok);
99 extern bool TSParserIsVisible(Oid prsId);
101 extern Oid get_ts_dict_oid(List *names, bool missing_ok);
102 extern bool TSDictionaryIsVisible(Oid dictId);
104 extern Oid get_ts_template_oid(List *names, bool missing_ok);
105 extern bool TSTemplateIsVisible(Oid tmplId);
107 extern Oid get_ts_config_oid(List *names, bool missing_ok);
108 extern bool TSConfigIsVisible(Oid cfgid);
110 extern void DeconstructQualifiedName(List *names,
111  char **nspname_p,
112  char **objname_p);
113 extern Oid LookupNamespaceNoError(const char *nspname);
114 extern Oid LookupExplicitNamespace(const char *nspname, bool missing_ok);
115 extern Oid get_namespace_oid(const char *nspname, bool missing_ok);
117 extern Oid LookupCreationNamespace(const char *nspname);
118 extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid);
119 extern Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p);
120 extern RangeVar *makeRangeVarFromNameList(List *names);
121 extern char *NameListToString(List *names);
122 extern char *NameListToQuotedString(List *names);
124 extern bool isTempNamespace(Oid namespaceId);
125 extern bool isTempToastNamespace(Oid namespaceId);
126 extern bool isTempOrTempToastNamespace(Oid namespaceId);
127 extern bool isAnyTempNamespace(Oid namespaceId);
128 extern bool isOtherTempNamespace(Oid namespaceId);
129 extern int GetTempNamespaceBackendId(Oid namespaceId);
130 extern Oid GetTempToastNamespace(void);
131 extern void GetTempNamespaceState(Oid *tempNamespaceId,
132  Oid *tempToastNamespaceId);
133 extern void SetTempNamespaceState(Oid tempNamespaceId,
134  Oid tempToastNamespaceId);
135 extern void ResetTempTableNamespace(void);
140 extern void PushOverrideSearchPath(OverrideSearchPath *newpath);
141 extern void PopOverrideSearchPath(void);
143 extern Oid get_collation_oid(List *collname, bool missing_ok);
144 extern Oid get_conversion_oid(List *conname, bool missing_ok);
145 extern Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding);
148 /* initialization & transaction cleanup code */
149 extern void InitializeSearchPath(void);
150 extern void AtEOXact_Namespace(bool isCommit, bool parallel);
151 extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
152  SubTransactionId parentSubid);
154 /* stuff for search_path GUC variable */
155 extern char *namespace_search_path;
157 extern List *fetch_search_path(bool includeImplicit);
158 extern int fetch_search_path_array(Oid *sarray, int sarray_len);
160 #endif /* NAMESPACE_H */
bool OperatorIsVisible(Oid oprid)
Definition: namespace.c:1707
bool TSConfigIsVisible(Oid cfgid)
Definition: namespace.c:2697
Oid RangeVarGetAndCheckCreationNamespace(RangeVar *newRelation, LOCKMODE lockmode, Oid *existing_relation_id)
Definition: namespace.c:508
int GetTempNamespaceBackendId(Oid namespaceId)
Definition: namespace.c:3195
Oid CollationGetCollid(const char *collname)
Definition: namespace.c:1974
Oid GetTempToastNamespace(void)
Definition: namespace.c:3220
void PushOverrideSearchPath(OverrideSearchPath *newpath)
Definition: namespace.c:3393
bool OpclassIsVisible(Oid opcid)
Definition: namespace.c:1793
Oid LookupExplicitNamespace(const char *nspname, bool missing_ok)
Definition: namespace.c:2853
bool FunctionIsVisible(Oid funcid)
Definition: namespace.c:1374
Definition: lockdefs.h:26
void GetTempNamespaceState(Oid *tempNamespaceId, Oid *tempToastNamespaceId)
Definition: namespace.c:3234
Oid oprid(Operator op)
Definition: parse_oper.c:245
Oid get_ts_dict_oid(List *names, bool missing_ok)
Definition: namespace.c:2386
void ResetTempTableNamespace(void)
Definition: namespace.c:4047
Oid get_ts_config_oid(List *names, bool missing_ok)
Definition: namespace.c:2639
char * namespace_search_path
Definition: namespace.c:191
bool TSTemplateIsVisible(Oid tmplId)
Definition: namespace.c:2571
void(* RangeVarGetRelidCallback)(const RangeVar *relation, Oid relId, Oid oldRelId, void *callback_arg)
Definition: namespace.h:50
uint32 SubTransactionId
Definition: c.h:401
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok, bool nowait, RangeVarGetRelidCallback callback, void *callback_arg)
Definition: namespace.c:218
unsigned int Oid
Definition: postgres_ext.h:31
Oid LookupCreationNamespace(const char *nspname)
Definition: namespace.c:2896
OverrideSearchPath * GetOverrideSearchPath(MemoryContext context)
Definition: namespace.c:3281
signed int int32
Definition: c.h:256
struct OverrideSearchPath OverrideSearchPath
Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding)
Definition: namespace.c:3602
Oid RelnameGetRelid(const char *relname)
Definition: namespace.c:654
Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p)
Definition: namespace.c:2956
bool isTempOrTempToastNamespace(Oid namespaceId)
Definition: namespace.c:3142
Definition: namespace.h:37
bool isTempNamespace(Oid namespaceId)
Definition: namespace.c:3118
Oid get_collation_oid(List *collname, bool missing_ok)
Definition: namespace.c:3493
Oid LookupNamespaceNoError(const char *nspname)
Definition: namespace.c:2823
void DeconstructQualifiedName(List *names, char **nspname_p, char **objname_p)
Definition: namespace.c:2769
struct _FuncCandidateList * FuncCandidateList
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48
Oid get_conversion_oid(List *conname, bool missing_ok)
Definition: namespace.c:3547
char * NameListToQuotedString(List *names)
Definition: namespace.c:3097
bool ConversionIsVisible(Oid conid)
Definition: namespace.c:2091
Oid ConversionGetConid(const char *conname)
Definition: namespace.c:2059
void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
Definition: namespace.c:3943
Oid TypenameGetTypid(const char *typname)
Definition: namespace.c:748
struct _FuncCandidateList * next
Definition: namespace.h:30
bool OverrideSearchPathMatchesCurrent(OverrideSearchPath *path)
Definition: namespace.c:3333
void InitializeSearchPath(void)
Definition: namespace.c:4110
Oid get_statistics_object_oid(List *names, bool missing_ok)
Definition: namespace.c:2138
OverrideSearchPath * CopyOverrideSearchPath(OverrideSearchPath *path)
Definition: namespace.c:3317
Oid get_ts_template_oid(List *names, bool missing_ok)
Definition: namespace.c:2513
char * NameListToString(List *names)
Definition: namespace.c:3063
Oid get_namespace_oid(const char *nspname, bool missing_ok)
Definition: namespace.c:3005
void PopOverrideSearchPath(void)
Definition: namespace.c:3452
bool isAnyTempNamespace(Oid namespaceId)
Definition: namespace.c:3156
RangeVar * makeRangeVarFromNameList(List *names)
Definition: namespace.c:3023
bool OpfamilyIsVisible(Oid opfid)
Definition: namespace.c:1876
bool TSParserIsVisible(Oid prsId)
Definition: namespace.c:2318
void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid)
Definition: namespace.c:615
FuncCandidateList OpernameGetCandidates(List *names, char oprkind, bool missing_schema_ok)
Definition: namespace.c:1547
bool StatisticsObjIsVisible(Oid stxid)
Definition: namespace.c:2195
Oid get_ts_parser_oid(List *names, bool missing_ok)
Definition: namespace.c:2260
void CheckSetNamespace(Oid oldNspOid, Oid nspOid)
Definition: namespace.c:2928
bool RelationIsVisible(Oid relid)
Definition: namespace.c:682
bool isTempToastNamespace(Oid namespaceId)
Definition: namespace.c:3130
bool TSDictionaryIsVisible(Oid dictId)
Definition: namespace.c:2444
FuncCandidateList FuncnameGetCandidates(List *names, int nargs, List *argnames, bool expand_variadic, bool expand_defaults, bool missing_ok)
Definition: namespace.c:903
bool TypeIsVisible(Oid typid)
Definition: namespace.c:777
Oid OpclassnameGetOpcid(Oid amid, const char *opcname)
Definition: namespace.c:1760
void SetTempNamespaceState(Oid tempNamespaceId, Oid tempToastNamespaceId)
Definition: namespace.c:3250
int fetch_search_path_array(Oid *sarray, int sarray_len)
Definition: namespace.c:4208
void AtEOXact_Namespace(bool isCommit, bool parallel)
Definition: namespace.c:3888
bool isOtherTempNamespace(Oid namespaceId)
Definition: namespace.c:3179
Oid RangeVarGetCreationNamespace(const RangeVar *newRelation)
Definition: namespace.c:421
bool CollationIsVisible(Oid collid)
Definition: namespace.c:2008
Definition: pg_list.h:45
Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
Definition: namespace.c:1445
Oid OpfamilynameGetOpfid(Oid amid, const char *opfname)
Definition: namespace.c:1843
List * fetch_search_path(bool includeImplicit)
Definition: namespace.c:4168