OSDN Git Service

6e9522bcd96c9a6acb3b22f0dbed987cbb11cea0
[pg-rex/syncrep.git] / src / include / catalog / namespace.h
1 /*-------------------------------------------------------------------------
2  *
3  * namespace.h
4  *        prototypes for functions in backend/catalog/namespace.c
5  *
6  *
7  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * $Id: namespace.h,v 1.26 2003/01/12 18:19:37 petere Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef NAMESPACE_H
15 #define NAMESPACE_H
16
17 #include "nodes/primnodes.h"
18
19
20 /*
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  */
26 typedef struct _FuncCandidateList
27 {
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         Oid                     args[1];                /* arg types --- VARIABLE LENGTH ARRAY */
33 }       *FuncCandidateList;     /* VARIABLE LENGTH STRUCT */
34
35 /*
36  *      This structure holds a list of opclass candidates found by namespace
37  *      lookup.
38  */
39 typedef struct _OpclassCandidateList
40 {
41         struct _OpclassCandidateList *next;
42         char       *opcname_tmp;        /* for internal use of namespace lookup */
43         int                     pathpos;                /* for internal use of namespace lookup */
44         Oid                     oid;                    /* the opclass's OID */
45         Oid                     opcintype;              /* type of input data for opclass */
46         bool            opcdefault;             /* T if opclass is default for opcintype */
47         Oid                     opckeytype;             /* type of index data, or InvalidOid */
48 }       *OpclassCandidateList;
49
50
51 extern Oid      RangeVarGetRelid(const RangeVar *relation, bool failOK);
52 extern Oid      RangeVarGetCreationNamespace(const RangeVar *newRelation);
53 extern Oid      RelnameGetRelid(const char *relname);
54 extern bool RelationIsVisible(Oid relid);
55
56 extern Oid      TypenameGetTypid(const char *typname);
57 extern bool TypeIsVisible(Oid typid);
58
59 extern FuncCandidateList FuncnameGetCandidates(List *names, int nargs);
60 extern bool FunctionIsVisible(Oid funcid);
61
62 extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind);
63 extern bool OperatorIsVisible(Oid oprid);
64
65 extern OpclassCandidateList OpclassGetCandidates(Oid amid);
66 extern Oid      OpclassnameGetOpcid(Oid amid, const char *opcname);
67 extern bool OpclassIsVisible(Oid opcid);
68
69 extern Oid      ConversionGetConid(const char *conname);
70 extern bool ConversionIsVisible(Oid conid);
71
72 extern void DeconstructQualifiedName(List *names,
73                                                  char **nspname_p,
74                                                  char **objname_p);
75 extern Oid      LookupExplicitNamespace(const char *nspname);
76
77 extern Oid      QualifiedNameGetCreationNamespace(List *names, char **objname_p);
78 extern RangeVar *makeRangeVarFromNameList(List *names);
79 extern char *NameListToString(List *names);
80 extern char *NameListToQuotedString(List *names);
81
82 extern bool isTempNamespace(Oid namespaceId);
83 extern bool isOtherTempNamespace(Oid namespaceId);
84
85 extern void PushSpecialNamespace(Oid namespaceId);
86 extern void PopSpecialNamespace(Oid namespaceId);
87
88 extern Oid      FindConversionByName(List *conname);
89 extern Oid      FindDefaultConversionProc(int4 for_encoding, int4 to_encoding);
90
91 /* initialization & transaction cleanup code */
92 extern void InitializeSearchPath(void);
93 extern void AtEOXact_Namespace(bool isCommit);
94
95 /* stuff for search_path GUC variable */
96 extern char *namespace_search_path;
97
98 extern const char *assign_search_path(const char *newval,
99                                    bool doit, bool interactive);
100
101 extern List *fetch_search_path(bool includeImplicit);
102
103 #endif   /* NAMESPACE_H */