Header And Logo

PostgreSQL
| The world's most advanced open source database.

namespace.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * namespace.h
00004  *    prototypes for functions in backend/catalog/namespace.c
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/catalog/namespace.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef NAMESPACE_H
00015 #define NAMESPACE_H
00016 
00017 #include "nodes/primnodes.h"
00018 #include "storage/lock.h"
00019 
00020 
00021 /*
00022  *  This structure holds a list of possible functions or operators
00023  *  found by namespace lookup.  Each function/operator is identified
00024  *  by OID and by argument types; the list must be pruned by type
00025  *  resolution rules that are embodied in the parser, not here.
00026  *  See FuncnameGetCandidates's comments for more info.
00027  */
00028 typedef struct _FuncCandidateList
00029 {
00030     struct _FuncCandidateList *next;
00031     int         pathpos;        /* for internal use of namespace lookup */
00032     Oid         oid;            /* the function or operator's OID */
00033     int         nargs;          /* number of arg types returned */
00034     int         nvargs;         /* number of args to become variadic array */
00035     int         ndargs;         /* number of defaulted args */
00036     int        *argnumbers;     /* args' positional indexes, if named call */
00037     Oid         args[1];        /* arg types --- VARIABLE LENGTH ARRAY */
00038 }   *FuncCandidateList; /* VARIABLE LENGTH STRUCT */
00039 
00040 /*
00041  *  Structure for xxxOverrideSearchPath functions
00042  */
00043 typedef struct OverrideSearchPath
00044 {
00045     List       *schemas;        /* OIDs of explicitly named schemas */
00046     bool        addCatalog;     /* implicitly prepend pg_catalog? */
00047     bool        addTemp;        /* implicitly prepend temp schema? */
00048 } OverrideSearchPath;
00049 
00050 typedef void (*RangeVarGetRelidCallback) (const RangeVar *relation, Oid relId,
00051                                            Oid oldRelId, void *callback_arg);
00052 
00053 #define RangeVarGetRelid(relation, lockmode, missing_ok) \
00054     RangeVarGetRelidExtended(relation, lockmode, missing_ok, false, NULL, NULL)
00055 
00056 extern Oid RangeVarGetRelidExtended(const RangeVar *relation,
00057                          LOCKMODE lockmode, bool missing_ok, bool nowait,
00058                          RangeVarGetRelidCallback callback,
00059                          void *callback_arg);
00060 extern Oid  RangeVarGetCreationNamespace(const RangeVar *newRelation);
00061 extern Oid RangeVarGetAndCheckCreationNamespace(RangeVar *newRelation,
00062                                      LOCKMODE lockmode,
00063                                      Oid *existing_relation_id);
00064 extern void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid);
00065 extern Oid  RelnameGetRelid(const char *relname);
00066 extern bool RelationIsVisible(Oid relid);
00067 
00068 extern Oid  TypenameGetTypid(const char *typname);
00069 extern bool TypeIsVisible(Oid typid);
00070 
00071 extern FuncCandidateList FuncnameGetCandidates(List *names,
00072                       int nargs, List *argnames,
00073                       bool expand_variadic,
00074                       bool expand_defaults);
00075 extern bool FunctionIsVisible(Oid funcid);
00076 
00077 extern Oid  OpernameGetOprid(List *names, Oid oprleft, Oid oprright);
00078 extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind);
00079 extern bool OperatorIsVisible(Oid oprid);
00080 
00081 extern Oid  OpclassnameGetOpcid(Oid amid, const char *opcname);
00082 extern bool OpclassIsVisible(Oid opcid);
00083 
00084 extern Oid  OpfamilynameGetOpfid(Oid amid, const char *opfname);
00085 extern bool OpfamilyIsVisible(Oid opfid);
00086 
00087 extern Oid  CollationGetCollid(const char *collname);
00088 extern bool CollationIsVisible(Oid collid);
00089 
00090 extern Oid  ConversionGetConid(const char *conname);
00091 extern bool ConversionIsVisible(Oid conid);
00092 
00093 extern Oid  get_ts_parser_oid(List *names, bool missing_ok);
00094 extern bool TSParserIsVisible(Oid prsId);
00095 
00096 extern Oid  get_ts_dict_oid(List *names, bool missing_ok);
00097 extern bool TSDictionaryIsVisible(Oid dictId);
00098 
00099 extern Oid  get_ts_template_oid(List *names, bool missing_ok);
00100 extern bool TSTemplateIsVisible(Oid tmplId);
00101 
00102 extern Oid  get_ts_config_oid(List *names, bool missing_ok);
00103 extern bool TSConfigIsVisible(Oid cfgid);
00104 
00105 extern void DeconstructQualifiedName(List *names,
00106                          char **nspname_p,
00107                          char **objname_p);
00108 extern Oid  LookupNamespaceNoError(const char *nspname);
00109 extern Oid  LookupExplicitNamespace(const char *nspname, bool missing_ok);
00110 extern Oid  get_namespace_oid(const char *nspname, bool missing_ok);
00111 
00112 extern Oid  LookupCreationNamespace(const char *nspname);
00113 extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid, Oid classid,
00114                   Oid objid);
00115 extern Oid  QualifiedNameGetCreationNamespace(List *names, char **objname_p);
00116 extern RangeVar *makeRangeVarFromNameList(List *names);
00117 extern char *NameListToString(List *names);
00118 extern char *NameListToQuotedString(List *names);
00119 
00120 extern bool isTempNamespace(Oid namespaceId);
00121 extern bool isTempToastNamespace(Oid namespaceId);
00122 extern bool isTempOrToastNamespace(Oid namespaceId);
00123 extern bool isAnyTempNamespace(Oid namespaceId);
00124 extern bool isOtherTempNamespace(Oid namespaceId);
00125 extern int  GetTempNamespaceBackendId(Oid namespaceId);
00126 extern Oid  GetTempToastNamespace(void);
00127 extern void ResetTempTableNamespace(void);
00128 
00129 extern OverrideSearchPath *GetOverrideSearchPath(MemoryContext context);
00130 extern OverrideSearchPath *CopyOverrideSearchPath(OverrideSearchPath *path);
00131 extern bool OverrideSearchPathMatchesCurrent(OverrideSearchPath *path);
00132 extern void PushOverrideSearchPath(OverrideSearchPath *newpath);
00133 extern void PopOverrideSearchPath(void);
00134 
00135 extern Oid  get_collation_oid(List *collname, bool missing_ok);
00136 extern Oid  get_conversion_oid(List *conname, bool missing_ok);
00137 extern Oid  FindDefaultConversionProc(int32 for_encoding, int32 to_encoding);
00138 
00139 /* initialization & transaction cleanup code */
00140 extern void InitializeSearchPath(void);
00141 extern void AtEOXact_Namespace(bool isCommit);
00142 extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
00143                       SubTransactionId parentSubid);
00144 
00145 /* stuff for search_path GUC variable */
00146 extern char *namespace_search_path;
00147 
00148 extern List *fetch_search_path(bool includeImplicit);
00149 extern int  fetch_search_path_array(Oid *sarray, int sarray_len);
00150 
00151 #endif   /* NAMESPACE_H */