1 /*-------------------------------------------------------------------------
4 * prototypes for functions in backend/catalog/namespace.c
7 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
12 *-------------------------------------------------------------------------
17 #include "nodes/primnodes.h"
21 * This structure holds a list of possible functions or operators
22 * found by namespace lookup. Each function/operator is identified
23 * by OID and by argument types; the list must be pruned by type
24 * resolution rules that are embodied in the parser, not here.
25 * See FuncnameGetCandidates's comments for more info.
27 typedef struct _FuncCandidateList
29 struct _FuncCandidateList
*next
;
30 int pathpos
; /* for internal use of namespace lookup */
31 Oid oid
; /* the function or operator's OID */
32 int nargs
; /* number of arg types returned */
33 int nvargs
; /* number of args to become variadic array */
34 int ndargs
; /* number of defaulted args */
35 Oid args
[1]; /* arg types --- VARIABLE LENGTH ARRAY */
36 } *FuncCandidateList
; /* VARIABLE LENGTH STRUCT */
39 * Structure for xxxOverrideSearchPath functions
41 typedef struct OverrideSearchPath
43 List
*schemas
; /* OIDs of explicitly named schemas */
44 bool addCatalog
; /* implicitly prepend pg_catalog? */
45 bool addTemp
; /* implicitly prepend temp schema? */
49 extern Oid
RangeVarGetRelid(const RangeVar
*relation
, bool failOK
);
50 extern Oid
RangeVarGetCreationNamespace(const RangeVar
*newRelation
);
51 extern Oid
RelnameGetRelid(const char *relname
);
52 extern bool RelationIsVisible(Oid relid
);
54 extern Oid
TypenameGetTypid(const char *typname
);
55 extern bool TypeIsVisible(Oid typid
);
57 extern FuncCandidateList
FuncnameGetCandidates(List
*names
, int nargs
,
59 bool expand_defaults
);
60 extern bool FunctionIsVisible(Oid funcid
);
62 extern Oid
OpernameGetOprid(List
*names
, Oid oprleft
, Oid oprright
);
63 extern FuncCandidateList
OpernameGetCandidates(List
*names
, char oprkind
);
64 extern bool OperatorIsVisible(Oid oprid
);
66 extern Oid
OpclassnameGetOpcid(Oid amid
, const char *opcname
);
67 extern bool OpclassIsVisible(Oid opcid
);
69 extern Oid
OpfamilynameGetOpfid(Oid amid
, const char *opfname
);
70 extern bool OpfamilyIsVisible(Oid opfid
);
72 extern Oid
ConversionGetConid(const char *conname
);
73 extern bool ConversionIsVisible(Oid conid
);
75 extern Oid
TSParserGetPrsid(List
*names
, bool failOK
);
76 extern bool TSParserIsVisible(Oid prsId
);
78 extern Oid
TSDictionaryGetDictid(List
*names
, bool failOK
);
79 extern bool TSDictionaryIsVisible(Oid dictId
);
81 extern Oid
TSTemplateGetTmplid(List
*names
, bool failOK
);
82 extern bool TSTemplateIsVisible(Oid tmplId
);
84 extern Oid
TSConfigGetCfgid(List
*names
, bool failOK
);
85 extern bool TSConfigIsVisible(Oid cfgid
);
87 extern void DeconstructQualifiedName(List
*names
,
90 extern Oid
LookupExplicitNamespace(const char *nspname
);
92 extern Oid
LookupCreationNamespace(const char *nspname
);
93 extern Oid
QualifiedNameGetCreationNamespace(List
*names
, char **objname_p
);
94 extern RangeVar
*makeRangeVarFromNameList(List
*names
);
95 extern char *NameListToString(List
*names
);
96 extern char *NameListToQuotedString(List
*names
);
98 extern bool isTempNamespace(Oid namespaceId
);
99 extern bool isTempToastNamespace(Oid namespaceId
);
100 extern bool isTempOrToastNamespace(Oid namespaceId
);
101 extern bool isAnyTempNamespace(Oid namespaceId
);
102 extern bool isOtherTempNamespace(Oid namespaceId
);
103 extern int GetTempNamespaceBackendId(Oid namespaceId
);
104 extern Oid
GetTempToastNamespace(void);
105 extern void ResetTempTableNamespace(void);
107 extern OverrideSearchPath
*GetOverrideSearchPath(MemoryContext context
);
108 extern void PushOverrideSearchPath(OverrideSearchPath
*newpath
);
109 extern void PopOverrideSearchPath(void);
111 extern Oid
FindConversionByName(List
*conname
);
112 extern Oid
FindDefaultConversionProc(int4 for_encoding
, int4 to_encoding
);
114 /* initialization & transaction cleanup code */
115 extern void InitializeSearchPath(void);
116 extern void AtEOXact_Namespace(bool isCommit
);
117 extern void AtEOSubXact_Namespace(bool isCommit
, SubTransactionId mySubid
,
118 SubTransactionId parentSubid
);
120 /* stuff for search_path GUC variable */
121 extern char *namespace_search_path
;
123 extern List
*fetch_search_path(bool includeImplicit
);
124 extern int fetch_search_path_array(Oid
*sarray
, int sarray_len
);
126 #endif /* NAMESPACE_H */