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_ts_parser_oid(List *names, bool missing_ok);
96 extern bool TSParserIsVisible(Oid prsId);
98 extern Oid get_ts_dict_oid(List *names, bool missing_ok);
99 extern bool TSDictionaryIsVisible(Oid dictId);
101 extern Oid get_ts_template_oid(List *names, bool missing_ok);
102 extern bool TSTemplateIsVisible(Oid tmplId);
104 extern Oid get_ts_config_oid(List *names, bool missing_ok);
105 extern bool TSConfigIsVisible(Oid cfgid);
107 extern void DeconstructQualifiedName(List *names,
108  char **nspname_p,
109  char **objname_p);
110 extern Oid LookupNamespaceNoError(const char *nspname);
111 extern Oid LookupExplicitNamespace(const char *nspname, bool missing_ok);
112 extern Oid get_namespace_oid(const char *nspname, bool missing_ok);
114 extern Oid LookupCreationNamespace(const char *nspname);
115 extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid);
116 extern Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p);
117 extern RangeVar *makeRangeVarFromNameList(List *names);
118 extern char *NameListToString(List *names);
119 extern char *NameListToQuotedString(List *names);
121 extern bool isTempNamespace(Oid namespaceId);
122 extern bool isTempToastNamespace(Oid namespaceId);
123 extern bool isTempOrTempToastNamespace(Oid namespaceId);
124 extern bool isAnyTempNamespace(Oid namespaceId);
125 extern bool isOtherTempNamespace(Oid namespaceId);
126 extern int GetTempNamespaceBackendId(Oid namespaceId);
127 extern Oid GetTempToastNamespace(void);
128 extern void GetTempNamespaceState(Oid *tempNamespaceId,
129  Oid *tempToastNamespaceId);
130 extern void SetTempNamespaceState(Oid tempNamespaceId,
131  Oid tempToastNamespaceId);
132 extern void ResetTempTableNamespace(void);
137 extern void PushOverrideSearchPath(OverrideSearchPath *newpath);
138 extern void PopOverrideSearchPath(void);
140 extern Oid get_collation_oid(List *collname, bool missing_ok);
141 extern Oid get_conversion_oid(List *conname, bool missing_ok);
142 extern Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding);
144 /* initialization & transaction cleanup code */
145 extern void InitializeSearchPath(void);
146 extern void AtEOXact_Namespace(bool isCommit, bool parallel);
147 extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
148  SubTransactionId parentSubid);
150 /* stuff for search_path GUC variable */
151 extern char *namespace_search_path;
153 extern List *fetch_search_path(bool includeImplicit);
154 extern int fetch_search_path_array(Oid *sarray, int sarray_len);
156 #endif /* NAMESPACE_H */
bool OperatorIsVisible(Oid oprid)
Definition: namespace.c:1706
bool TSConfigIsVisible(Oid cfgid)
Definition: namespace.c:2531
Oid RangeVarGetAndCheckCreationNamespace(RangeVar *newRelation, LOCKMODE lockmode, Oid *existing_relation_id)
Definition: namespace.c:507
int GetTempNamespaceBackendId(Oid namespaceId)
Definition: namespace.c:3029
Oid CollationGetCollid(const char *collname)
Definition: namespace.c:1922
Oid GetTempToastNamespace(void)
Definition: namespace.c:3054
void PushOverrideSearchPath(OverrideSearchPath *newpath)
Definition: namespace.c:3227
bool OpclassIsVisible(Oid opcid)
Definition: namespace.c:1792
Oid LookupExplicitNamespace(const char *nspname, bool missing_ok)
Definition: namespace.c:2687
bool FunctionIsVisible(Oid funcid)
Definition: namespace.c:1373
Definition: lockdefs.h:26
void GetTempNamespaceState(Oid *tempNamespaceId, Oid *tempToastNamespaceId)
Definition: namespace.c:3068
Oid oprid(Operator op)
Definition: parse_oper.c:243
Oid get_ts_dict_oid(List *names, bool missing_ok)
Definition: namespace.c:2220
void ResetTempTableNamespace(void)
Definition: namespace.c:3897
Oid get_ts_config_oid(List *names, bool missing_ok)
Definition: namespace.c:2473
char * namespace_search_path
Definition: namespace.c:190
bool TSTemplateIsVisible(Oid tmplId)
Definition: namespace.c:2405
void(* RangeVarGetRelidCallback)(const RangeVar *relation, Oid relId, Oid oldRelId, void *callback_arg)
Definition: namespace.h:50
uint32 SubTransactionId
Definition: c.h:398
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok, bool nowait, RangeVarGetRelidCallback callback, void *callback_arg)
Definition: namespace.c:217
unsigned int Oid
Definition: postgres_ext.h:31
Oid LookupCreationNamespace(const char *nspname)
Definition: namespace.c:2730
OverrideSearchPath * GetOverrideSearchPath(MemoryContext context)
Definition: namespace.c:3115
signed int int32
Definition: c.h:253
struct _FuncCandidateList * FuncCandidateList
struct OverrideSearchPath OverrideSearchPath
Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding)
Definition: namespace.c:3452
Oid RelnameGetRelid(const char *relname)
Definition: namespace.c:653
Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p)
Definition: namespace.c:2790
bool isTempOrTempToastNamespace(Oid namespaceId)
Definition: namespace.c:2976
Definition: namespace.h:37
bool isTempNamespace(Oid namespaceId)
Definition: namespace.c:2952
Oid get_collation_oid(List *collname, bool missing_ok)
Definition: namespace.c:3324
Oid LookupNamespaceNoError(const char *nspname)
Definition: namespace.c:2657
void DeconstructQualifiedName(List *names, char **nspname_p, char **objname_p)
Definition: namespace.c:2603
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:49
Oid get_conversion_oid(List *conname, bool missing_ok)
Definition: namespace.c:3397
char * NameListToQuotedString(List *names)
Definition: namespace.c:2931
bool ConversionIsVisible(Oid conid)
Definition: namespace.c:2047
Oid ConversionGetConid(const char *conname)
Definition: namespace.c:2015
void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
Definition: namespace.c:3793
Oid TypenameGetTypid(const char *typname)
Definition: namespace.c:747
struct _FuncCandidateList * next
Definition: namespace.h:30
bool OverrideSearchPathMatchesCurrent(OverrideSearchPath *path)
Definition: namespace.c:3167
void InitializeSearchPath(void)
Definition: namespace.c:3960
OverrideSearchPath * CopyOverrideSearchPath(OverrideSearchPath *path)
Definition: namespace.c:3151
Oid get_ts_template_oid(List *names, bool missing_ok)
Definition: namespace.c:2347
char * NameListToString(List *names)
Definition: namespace.c:2897
Oid get_namespace_oid(const char *nspname, bool missing_ok)
Definition: namespace.c:2839
void PopOverrideSearchPath(void)
Definition: namespace.c:3286
bool isAnyTempNamespace(Oid namespaceId)
Definition: namespace.c:2990
RangeVar * makeRangeVarFromNameList(List *names)
Definition: namespace.c:2857
bool OpfamilyIsVisible(Oid opfid)
Definition: namespace.c:1875
bool TSParserIsVisible(Oid prsId)
Definition: namespace.c:2152
void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid)
Definition: namespace.c:614
FuncCandidateList OpernameGetCandidates(List *names, char oprkind, bool missing_schema_ok)
Definition: namespace.c:1546
Oid get_ts_parser_oid(List *names, bool missing_ok)
Definition: namespace.c:2094
void CheckSetNamespace(Oid oldNspOid, Oid nspOid)
Definition: namespace.c:2762
bool RelationIsVisible(Oid relid)
Definition: namespace.c:681
bool isTempToastNamespace(Oid namespaceId)
Definition: namespace.c:2964
bool TSDictionaryIsVisible(Oid dictId)
Definition: namespace.c:2278
FuncCandidateList FuncnameGetCandidates(List *names, int nargs, List *argnames, bool expand_variadic, bool expand_defaults, bool missing_ok)
Definition: namespace.c:902
bool TypeIsVisible(Oid typid)
Definition: namespace.c:776
Oid OpclassnameGetOpcid(Oid amid, const char *opcname)
Definition: namespace.c:1759
void SetTempNamespaceState(Oid tempNamespaceId, Oid tempToastNamespaceId)
Definition: namespace.c:3084
int fetch_search_path_array(Oid *sarray, int sarray_len)
Definition: namespace.c:4058
void AtEOXact_Namespace(bool isCommit, bool parallel)
Definition: namespace.c:3738
bool isOtherTempNamespace(Oid namespaceId)
Definition: namespace.c:3013
Oid RangeVarGetCreationNamespace(const RangeVar *newRelation)
Definition: namespace.c:420
bool CollationIsVisible(Oid collid)
Definition: namespace.c:1965
Definition: pg_list.h:45
Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
Definition: namespace.c:1444
Oid OpfamilynameGetOpfid(Oid amid, const char *opfname)
Definition: namespace.c:1842
List * fetch_search_path(bool includeImplicit)
Definition: namespace.c:4018