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-2024, 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 markNullableIfNeeded(ParseState *pstate, Var *var);
45 extern void markVarForSelectPriv(ParseState *pstate, Var *var);
46 extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation,
47  int lockmode);
49  RangeVar *relation,
50  Alias *alias,
51  bool inh,
52  bool inFromCl);
54  Relation rel,
55  int lockmode,
56  Alias *alias,
57  bool inh,
58  bool inFromCl);
60  Query *subquery,
61  Alias *alias,
62  bool lateral,
63  bool inFromCl);
65  List *funcnames,
66  List *funcexprs,
67  List *coldeflists,
68  RangeFunction *rangefunc,
69  bool lateral,
70  bool inFromCl);
72  List *exprs,
73  List *coltypes,
74  List *coltypmods,
75  List *colcollations,
76  Alias *alias,
77  bool lateral,
78  bool inFromCl);
80  TableFunc *tf,
81  Alias *alias,
82  bool lateral,
83  bool inFromCl);
85  List *colnames,
86  ParseNamespaceColumn *nscolumns,
87  JoinType jointype,
88  int nummergedcols,
89  List *aliasvars,
90  List *leftcols,
91  List *rightcols,
92  Alias *join_using_alias,
93  Alias *alias,
94  bool inFromCl);
96  CommonTableExpr *cte,
97  Index levelsup,
98  RangeVar *rv,
99  bool inFromCl);
101  RangeVar *rv,
102  bool inFromCl);
104  List *groupClauses);
105 extern RTEPermissionInfo *addRTEPermissionInfo(List **rteperminfos,
106  RangeTblEntry *rte);
107 extern RTEPermissionInfo *getRTEPermissionInfo(List *rteperminfos,
108  RangeTblEntry *rte);
109 extern bool isLockedRefname(ParseState *pstate, const char *refname);
110 extern void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem,
111  bool addToJoinList,
112  bool addToRelNameSpace, bool addToVarNameSpace);
113 extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn();
114 extern void errorMissingColumn(ParseState *pstate,
115  const char *relname, const char *colname, int location) pg_attribute_noreturn();
116 extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
117  int location, bool include_dropped,
118  List **colnames, List **colvars);
119 extern List *expandNSItemVars(ParseState *pstate, ParseNamespaceItem *nsitem,
120  int sublevels_up, int location,
121  List **colnames);
122 extern List *expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem,
123  int sublevels_up, bool require_col_privs,
124  int location);
125 extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK);
126 extern const NameData *attnumAttName(Relation rd, int attid);
127 extern Oid attnumTypeId(Relation rd, int attid);
128 extern Oid attnumCollationId(Relation rd, int attid);
129 extern bool isQueryUsingTempRelation(Query *query);
130 
131 #endif /* PARSE_RELATION_H */
#define pg_attribute_noreturn()
Definition: c.h:232
unsigned int Index
Definition: c.h:593
JoinType
Definition: nodes.h:288
void markNullableIfNeeded(ParseState *pstate, Var *var)
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)
ParseNamespaceItem * addRangeTableEntryForGroup(ParseState *pstate, List *groupClauses)
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 * expandNSItemVars(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, int location, List **colnames)
List * expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, bool require_col_privs, int location)
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:54
Definition: nodes.h:129
Definition: primnodes.h:248
Definition: c.h:720