Header And Logo

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

parse_relation.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * parse_relation.h
00004  *    prototypes for parse_relation.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/parser/parse_relation.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef PARSE_RELATION_H
00015 #define PARSE_RELATION_H
00016 
00017 #include "parser/parse_node.h"
00018 
00019 extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate,
00020                      const char *schemaname,
00021                      const char *refname,
00022                      int location,
00023                      int *sublevels_up);
00024 extern CommonTableExpr *scanNameSpaceForCTE(ParseState *pstate,
00025                     const char *refname,
00026                     Index *ctelevelsup);
00027 extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1,
00028                         List *namespace2);
00029 extern int RTERangeTablePosn(ParseState *pstate,
00030                   RangeTblEntry *rte,
00031                   int *sublevels_up);
00032 extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate,
00033                        int varno,
00034                        int sublevels_up);
00035 extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte,
00036              int rtelevelsup);
00037 extern Node *scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte,
00038                  char *colname, int location);
00039 extern Node *colNameToVar(ParseState *pstate, char *colname, bool localonly,
00040              int location);
00041 extern void markVarForSelectPriv(ParseState *pstate, Var *var,
00042                      RangeTblEntry *rte);
00043 extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation,
00044                 int lockmode);
00045 extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
00046                    RangeVar *relation,
00047                    Alias *alias,
00048                    bool inh,
00049                    bool inFromCl);
00050 extern RangeTblEntry *addRangeTableEntryForRelation(ParseState *pstate,
00051                               Relation rel,
00052                               Alias *alias,
00053                               bool inh,
00054                               bool inFromCl);
00055 extern RangeTblEntry *addRangeTableEntryForSubquery(ParseState *pstate,
00056                               Query *subquery,
00057                               Alias *alias,
00058                               bool lateral,
00059                               bool inFromCl);
00060 extern RangeTblEntry *addRangeTableEntryForFunction(ParseState *pstate,
00061                               char *funcname,
00062                               Node *funcexpr,
00063                               RangeFunction *rangefunc,
00064                               bool lateral,
00065                               bool inFromCl);
00066 extern RangeTblEntry *addRangeTableEntryForValues(ParseState *pstate,
00067                             List *exprs,
00068                             List *collations,
00069                             Alias *alias,
00070                             bool lateral,
00071                             bool inFromCl);
00072 extern RangeTblEntry *addRangeTableEntryForJoin(ParseState *pstate,
00073                           List *colnames,
00074                           JoinType jointype,
00075                           List *aliasvars,
00076                           Alias *alias,
00077                           bool inFromCl);
00078 extern RangeTblEntry *addRangeTableEntryForCTE(ParseState *pstate,
00079                          CommonTableExpr *cte,
00080                          Index levelsup,
00081                          RangeVar *rv,
00082                          bool inFromCl);
00083 extern bool isLockedRefname(ParseState *pstate, const char *refname);
00084 extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte,
00085               bool addToJoinList,
00086               bool addToRelNameSpace, bool addToVarNameSpace);
00087 extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) __attribute__((noreturn));
00088 extern void errorMissingColumn(ParseState *pstate,
00089                    char *relname, char *colname, int location) __attribute__((noreturn));
00090 extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
00091           int location, bool include_dropped,
00092           List **colnames, List **colvars);
00093 extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte,
00094                int rtindex, int sublevels_up, int location);
00095 extern int  attnameAttNum(Relation rd, const char *attname, bool sysColOK);
00096 extern Name attnumAttName(Relation rd, int attid);
00097 extern Oid  attnumTypeId(Relation rd, int attid);
00098 extern Oid  attnumCollationId(Relation rd, int attid);
00099 extern bool isQueryUsingTempRelation(Query *query);
00100 
00101 #endif   /* PARSE_RELATION_H */