1 /*-------------------------------------------------------------------------
4 * prototypes for functions in backend/catalog/namespace.c
7 * Portions Copyright (c) 1996-2008, 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.
26 typedef struct _FuncCandidateList
28 struct _FuncCandidateList
*next
;
29 int pathpos
; /* for internal use of namespace lookup */
30 Oid oid
; /* the function or operator's OID */
31 int nargs
; /* number of arg types returned */
32 int nvargs
; /* number of args to become variadic array */
33 Oid args
[1]; /* arg types --- VARIABLE LENGTH ARRAY */
34 } *FuncCandidateList
; /* VARIABLE LENGTH STRUCT */
37 * Structure for xxxOverrideSearchPath functions
39 typedef struct OverrideSearchPath
41 List
*schemas
; /* OIDs of explicitly named schemas */
42 bool addCatalog
; /* implicitly prepend pg_catalog? */
43 bool addTemp
; /* implicitly prepend temp schema? */
47 extern Oid
RangeVarGetRelid(const RangeVar
*relation
, bool failOK
);
48 extern Oid
RangeVarGetCreationNamespace(const RangeVar
*newRelation
);
49 extern Oid
RelnameGetRelid(const char *relname
);
50 extern bool RelationIsVisible(Oid relid
);
52 extern Oid
TypenameGetTypid(const char *typname
);
53 extern bool TypeIsVisible(Oid typid
);
55 extern FuncCandidateList
FuncnameGetCandidates(List
*names
, int nargs
,
56 bool expand_variadic
);
57 extern bool FunctionIsVisible(Oid funcid
);
59 extern Oid
OpernameGetOprid(List
*names
, Oid oprleft
, Oid oprright
);
60 extern FuncCandidateList
OpernameGetCandidates(List
*names
, char oprkind
);
61 extern bool OperatorIsVisible(Oid oprid
);
63 extern Oid
OpclassnameGetOpcid(Oid amid
, const char *opcname
);
64 extern bool OpclassIsVisible(Oid opcid
);
66 extern Oid
OpfamilynameGetOpfid(Oid amid
, const char *opfname
);
67 extern bool OpfamilyIsVisible(Oid opfid
);
69 extern Oid
ConversionGetConid(const char *conname
);
70 extern bool ConversionIsVisible(Oid conid
);
72 extern Oid
TSParserGetPrsid(List
*names
, bool failOK
);
73 extern bool TSParserIsVisible(Oid prsId
);
75 extern Oid
TSDictionaryGetDictid(List
*names
, bool failOK
);
76 extern bool TSDictionaryIsVisible(Oid dictId
);
78 extern Oid
TSTemplateGetTmplid(List
*names
, bool failOK
);
79 extern bool TSTemplateIsVisible(Oid tmplId
);
81 extern Oid
TSConfigGetCfgid(List
*names
, bool failOK
);
82 extern bool TSConfigIsVisible(Oid cfgid
);
84 extern void DeconstructQualifiedName(List
*names
,
87 extern Oid
LookupExplicitNamespace(const char *nspname
);
89 extern Oid
LookupCreationNamespace(const char *nspname
);
90 extern Oid
QualifiedNameGetCreationNamespace(List
*names
, char **objname_p
);
91 extern RangeVar
*makeRangeVarFromNameList(List
*names
);
92 extern char *NameListToString(List
*names
);
93 extern char *NameListToQuotedString(List
*names
);
95 extern bool isTempNamespace(Oid namespaceId
);
96 extern bool isTempToastNamespace(Oid namespaceId
);
97 extern bool isTempOrToastNamespace(Oid namespaceId
);
98 extern bool isAnyTempNamespace(Oid namespaceId
);
99 extern bool isOtherTempNamespace(Oid namespaceId
);
100 extern int GetTempNamespaceBackendId(Oid namespaceId
);
101 extern Oid
GetTempToastNamespace(void);
102 extern void ResetTempTableNamespace(void);
104 extern OverrideSearchPath
*GetOverrideSearchPath(MemoryContext context
);
105 extern void PushOverrideSearchPath(OverrideSearchPath
*newpath
);
106 extern void PopOverrideSearchPath(void);
108 extern Oid
FindConversionByName(List
*conname
);
109 extern Oid
FindDefaultConversionProc(int4 for_encoding
, int4 to_encoding
);
111 /* initialization & transaction cleanup code */
112 extern void InitializeSearchPath(void);
113 extern void AtEOXact_Namespace(bool isCommit
);
114 extern void AtEOSubXact_Namespace(bool isCommit
, SubTransactionId mySubid
,
115 SubTransactionId parentSubid
);
117 /* stuff for search_path GUC variable */
118 extern char *namespace_search_path
;
120 extern List
*fetch_search_path(bool includeImplicit
);
121 extern int fetch_search_path_array(Oid
*sarray
, int sarray_len
);
123 #endif /* NAMESPACE_H */