PostgreSQL Source Code  git master
parse_relation.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * parse_relation.h
4  * prototypes for parse_relation.c.
5  *
6  *
7  * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/parser/parse_relation.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef PARSE_RELATION_H
15 #define PARSE_RELATION_H
16 
17 #include "parser/parse_node.h"
18 
19 
21  const char *schemaname,
22  const char *refname,
23  int location,
24  int *sublevels_up);
26  const char *refname,
27  Index *ctelevelsup);
28 extern bool scanNameSpaceForENR(ParseState *pstate, const char *refname);
29 extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1,
30  List *namespace2);
32  int varno,
33  int sublevels_up);
35  int varno,
36  int sublevels_up);
38  int rtelevelsup);
39 extern Node *scanNSItemForColumn(ParseState *pstate, ParseNamespaceItem *nsitem,
40  int sublevels_up, const char *colname,
41  int location);
42 extern Node *colNameToVar(ParseState *pstate, const char *colname, bool localonly,
43  int location);
44 extern void markVarForSelectPriv(ParseState *pstate, Var *var);
45 extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation,
46  int lockmode);
48  RangeVar *relation,
49  Alias *alias,
50  bool inh,
51  bool inFromCl);
53  Relation rel,
54  int lockmode,
55  Alias *alias,
56  bool inh,
57  bool inFromCl);
59  Query *subquery,
60  Alias *alias,
61  bool lateral,
62  bool inFromCl);
64  List *funcnames,
65  List *funcexprs,
66  List *coldeflists,
67  RangeFunction *rangefunc,
68  bool lateral,
69  bool inFromCl);
71  List *exprs,
72  List *coltypes,
73  List *coltypmods,
74  List *colcollations,
75  Alias *alias,
76  bool lateral,
77  bool inFromCl);
79  TableFunc *tf,
80  Alias *alias,
81  bool lateral,
82  bool inFromCl);
84  List *colnames,
85  ParseNamespaceColumn *nscolumns,
86  JoinType jointype,
87  int nummergedcols,
88  List *aliasvars,
89  List *leftcols,
90  List *rightcols,
91  Alias *join_using_alias,
92  Alias *alias,
93  bool inFromCl);
95  CommonTableExpr *cte,
96  Index levelsup,
97  RangeVar *rv,
98  bool inFromCl);
100  RangeVar *rv,
101  bool inFromCl);
102 extern RTEPermissionInfo *addRTEPermissionInfo(List **rteperminfos,
103  RangeTblEntry *rte);
104 extern RTEPermissionInfo *getRTEPermissionInfo(List *rteperminfos,
105  RangeTblEntry *rte);
106 extern bool isLockedRefname(ParseState *pstate, const char *refname);
107 extern void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem,
108  bool addToJoinList,
109  bool addToRelNameSpace, bool addToVarNameSpace);
110 extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn();
111 extern void errorMissingColumn(ParseState *pstate,
112  const char *relname, const char *colname, int location) pg_attribute_noreturn();
113 extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
114  int location, bool include_dropped,
115  List **colnames, List **colvars);
117  int sublevels_up, int location,
118  List **colnames);
119 extern List *expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem,
120  int sublevels_up, bool require_col_privs,
121  int location);
122 extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK);
123 extern const NameData *attnumAttName(Relation rd, int attid);
124 extern Oid attnumTypeId(Relation rd, int attid);
125 extern Oid attnumCollationId(Relation rd, int attid);
126 extern bool isQueryUsingTempRelation(Query *query);
127 
128 #endif /* PARSE_RELATION_H */
#define pg_attribute_noreturn()
Definition: c.h:201
unsigned int Index
Definition: c.h:550
JoinType
Definition: nodes.h:288
ParseNamespaceItem * addRangeTableEntryForCTE(ParseState *pstate, CommonTableExpr *cte, Index levelsup, RangeVar *rv, bool inFromCl)
RangeTblEntry * GetRTEByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
ParseNamespaceItem * addRangeTableEntry(ParseState *pstate, RangeVar *relation, Alias *alias, bool inh, bool inFromCl)
RTEPermissionInfo * addRTEPermissionInfo(List **rteperminfos, RangeTblEntry *rte)
void errorMissingColumn(ParseState *pstate, const char *relname, const char *colname, int location) pg_attribute_noreturn()
ParseNamespaceItem * addRangeTableEntryForJoin(ParseState *pstate, List *colnames, ParseNamespaceColumn *nscolumns, JoinType jointype, int nummergedcols, List *aliasvars, List *leftcols, List *rightcols, Alias *join_using_alias, Alias *alias, bool inFromCl)
Oid attnumCollationId(Relation rd, int attid)
void markVarForSelectPriv(ParseState *pstate, Var *var)
CommonTableExpr * scanNameSpaceForCTE(ParseState *pstate, const char *refname, Index *ctelevelsup)
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, int lockmode, Alias *alias, bool inh, bool inFromCl)
RTEPermissionInfo * getRTEPermissionInfo(List *rteperminfos, RangeTblEntry *rte)
const NameData * attnumAttName(Relation rd, int attid)
Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem, bool addToJoinList, bool addToRelNameSpace, bool addToVarNameSpace)
ParseNamespaceItem * GetNSItemByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
ParseNamespaceItem * addRangeTableEntryForSubquery(ParseState *pstate, Query *subquery, Alias *alias, bool lateral, bool inFromCl)
Node * scanNSItemForColumn(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, const char *colname, int location)
ParseNamespaceItem * refnameNamespaceItem(ParseState *pstate, const char *schemaname, const char *refname, int location, int *sublevels_up)
bool scanNameSpaceForENR(ParseState *pstate, const char *refname)
bool isLockedRefname(ParseState *pstate, const char *refname)
Oid attnumTypeId(Relation rd, int attid)
ParseNamespaceItem * addRangeTableEntryForFunction(ParseState *pstate, List *funcnames, List *funcexprs, List *coldeflists, RangeFunction *rangefunc, bool lateral, bool inFromCl)
Node * colNameToVar(ParseState *pstate, const char *colname, bool localonly, int location)
ParseNamespaceItem * addRangeTableEntryForTableFunc(ParseState *pstate, TableFunc *tf, Alias *alias, bool lateral, bool inFromCl)
ParseNamespaceItem * addRangeTableEntryForValues(ParseState *pstate, List *exprs, List *coltypes, List *coltypmods, List *colcollations, Alias *alias, bool lateral, bool inFromCl)
List * expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, bool require_col_privs, int location)
List * expandNSItemVars(ParseNamespaceItem *nsitem, int sublevels_up, int location, List **colnames)
bool isQueryUsingTempRelation(Query *query)
ParseNamespaceItem * addRangeTableEntryForENR(ParseState *pstate, RangeVar *rv, bool inFromCl)
void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars)
CommonTableExpr * GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, int rtelevelsup)
int attnameAttNum(Relation rd, const char *attname, bool sysColOK)
void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn()
void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, List *namespace2)
NameData attname
Definition: pg_attribute.h:41
NameData relname
Definition: pg_class.h:38
unsigned int Oid
Definition: postgres_ext.h:31
Definition: pg_list.h:52
Definition: nodes.h:118
Definition: primnodes.h:205
Definition: c.h:677