1999-02-13 18:22:53 -05:00
|
|
|
/*-------------------------------------------------------------------------
|
1997-11-25 17:07:18 -05:00
|
|
|
*
|
1999-07-18 20:26:20 -04:00
|
|
|
* parse_relation.h
|
|
|
|
|
* prototypes for parse_relation.c.
|
1997-11-25 17:07:18 -05:00
|
|
|
*
|
|
|
|
|
*
|
2013-01-01 17:15:01 -05:00
|
|
|
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
2000-01-26 00:58:53 -05:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1997-11-25 17:07:18 -05:00
|
|
|
*
|
2010-09-20 16:08:53 -04:00
|
|
|
* src/include/parser/parse_relation.h
|
1997-11-25 17:07:18 -05:00
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1999-07-18 20:26:20 -04:00
|
|
|
#ifndef PARSE_RELATION_H
|
|
|
|
|
#define PARSE_RELATION_H
|
1997-11-25 17:07:18 -05:00
|
|
|
|
1999-07-15 19:04:24 -04:00
|
|
|
#include "parser/parse_node.h"
|
1997-11-25 17:07:18 -05:00
|
|
|
|
2002-03-11 19:52:10 -05:00
|
|
|
extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate,
|
2002-09-04 16:31:48 -04:00
|
|
|
const char *schemaname,
|
|
|
|
|
const char *refname,
|
2008-09-01 16:42:46 -04:00
|
|
|
int location,
|
2002-09-04 16:31:48 -04:00
|
|
|
int *sublevels_up);
|
2008-10-05 22:12:56 -04:00
|
|
|
extern CommonTableExpr *scanNameSpaceForCTE(ParseState *pstate,
|
2009-06-11 10:49:15 -04:00
|
|
|
const char *refname,
|
|
|
|
|
Index *ctelevelsup);
|
2005-06-04 20:38:11 -04:00
|
|
|
extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1,
|
|
|
|
|
List *namespace2);
|
2000-09-12 17:07:18 -04:00
|
|
|
extern int RTERangeTablePosn(ParseState *pstate,
|
2001-03-21 23:01:46 -05:00
|
|
|
RangeTblEntry *rte,
|
|
|
|
|
int *sublevels_up);
|
2004-04-02 14:07:02 -05:00
|
|
|
extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate,
|
2004-08-29 01:07:03 -04:00
|
|
|
int varno,
|
|
|
|
|
int sublevels_up);
|
2008-10-06 11:15:22 -04:00
|
|
|
extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte,
|
2009-06-11 10:49:15 -04:00
|
|
|
int rtelevelsup);
|
2004-04-02 14:07:02 -05:00
|
|
|
extern Node *scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte,
|
2006-03-14 17:48:25 -05:00
|
|
|
char *colname, int location);
|
|
|
|
|
extern Node *colNameToVar(ParseState *pstate, char *colname, bool localonly,
|
2006-10-03 20:30:14 -04:00
|
|
|
int location);
|
2009-01-22 15:16:10 -05:00
|
|
|
extern void markVarForSelectPriv(ParseState *pstate, Var *var,
|
2009-06-11 10:49:15 -04:00
|
|
|
RangeTblEntry *rte);
|
2008-09-01 16:42:46 -04:00
|
|
|
extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation,
|
2009-06-11 10:49:15 -04:00
|
|
|
int lockmode);
|
1998-09-01 00:40:42 -04:00
|
|
|
extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
|
2002-03-21 21:56:37 -05:00
|
|
|
RangeVar *relation,
|
|
|
|
|
Alias *alias,
|
|
|
|
|
bool inh,
|
|
|
|
|
bool inFromCl);
|
|
|
|
|
extern RangeTblEntry *addRangeTableEntryForRelation(ParseState *pstate,
|
2005-04-13 12:50:55 -04:00
|
|
|
Relation rel,
|
2002-09-04 16:31:48 -04:00
|
|
|
Alias *alias,
|
|
|
|
|
bool inh,
|
|
|
|
|
bool inFromCl);
|
2000-09-29 14:21:41 -04:00
|
|
|
extern RangeTblEntry *addRangeTableEntryForSubquery(ParseState *pstate,
|
2001-03-21 23:01:46 -05:00
|
|
|
Query *subquery,
|
2002-03-21 11:02:16 -05:00
|
|
|
Alias *alias,
|
2012-08-07 19:02:54 -04:00
|
|
|
bool lateral,
|
2001-03-21 23:01:46 -05:00
|
|
|
bool inFromCl);
|
2002-05-12 16:10:05 -04:00
|
|
|
extern RangeTblEntry *addRangeTableEntryForFunction(ParseState *pstate,
|
2002-09-04 16:31:48 -04:00
|
|
|
char *funcname,
|
|
|
|
|
Node *funcexpr,
|
|
|
|
|
RangeFunction *rangefunc,
|
2012-08-07 19:02:54 -04:00
|
|
|
bool lateral,
|
2002-09-04 16:31:48 -04:00
|
|
|
bool inFromCl);
|
2006-08-01 21:59:48 -04:00
|
|
|
extern RangeTblEntry *addRangeTableEntryForValues(ParseState *pstate,
|
|
|
|
|
List *exprs,
|
2011-04-18 15:31:52 -04:00
|
|
|
List *collations,
|
2006-08-01 21:59:48 -04:00
|
|
|
Alias *alias,
|
2012-08-19 14:12:16 -04:00
|
|
|
bool lateral,
|
2006-08-01 21:59:48 -04:00
|
|
|
bool inFromCl);
|
2002-03-11 19:52:10 -05:00
|
|
|
extern RangeTblEntry *addRangeTableEntryForJoin(ParseState *pstate,
|
|
|
|
|
List *colnames,
|
|
|
|
|
JoinType jointype,
|
2002-04-28 15:54:29 -04:00
|
|
|
List *aliasvars,
|
2002-03-21 11:02:16 -05:00
|
|
|
Alias *alias,
|
2002-03-11 19:52:10 -05:00
|
|
|
bool inFromCl);
|
2008-10-04 17:56:55 -04:00
|
|
|
extern RangeTblEntry *addRangeTableEntryForCTE(ParseState *pstate,
|
|
|
|
|
CommonTableExpr *cte,
|
|
|
|
|
Index levelsup,
|
2011-02-25 18:56:23 -05:00
|
|
|
RangeVar *rv,
|
2008-10-04 17:56:55 -04:00
|
|
|
bool inFromCl);
|
2009-10-27 13:11:18 -04:00
|
|
|
extern bool isLockedRefname(ParseState *pstate, const char *refname);
|
2001-02-14 16:35:07 -05:00
|
|
|
extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte,
|
2005-06-04 20:38:11 -04:00
|
|
|
bool addToJoinList,
|
|
|
|
|
bool addToRelNameSpace, bool addToVarNameSpace);
|
2013-02-12 07:13:22 -05:00
|
|
|
extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) __attribute__((noreturn));
|
2012-08-07 19:02:54 -04:00
|
|
|
extern void errorMissingColumn(ParseState *pstate,
|
2013-02-12 07:13:22 -05:00
|
|
|
char *relname, char *colname, int location) __attribute__((noreturn));
|
2005-06-04 15:19:42 -04:00
|
|
|
extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
|
2008-09-01 16:42:46 -04:00
|
|
|
int location, bool include_dropped,
|
2004-08-29 01:07:03 -04:00
|
|
|
List **colnames, List **colvars);
|
2005-06-04 15:19:42 -04:00
|
|
|
extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte,
|
2008-09-01 16:42:46 -04:00
|
|
|
int rtindex, int sublevels_up, int location);
|
2002-08-02 14:15:10 -04:00
|
|
|
extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK);
|
2001-10-23 13:39:03 -04:00
|
|
|
extern Name attnumAttName(Relation rd, int attid);
|
1998-02-25 23:46:47 -05:00
|
|
|
extern Oid attnumTypeId(Relation rd, int attid);
|
2011-04-11 21:32:53 -04:00
|
|
|
extern Oid attnumCollationId(Relation rd, int attid);
|
Clean up the mess around EXPLAIN and materialized views.
Revert the matview-related changes in explain.c's API, as per recent
complaint from Robert Haas. The reason for these appears to have been
principally some ill-considered choices around having intorel_startup do
what ought to be parse-time checking, plus a poor arrangement for passing
it the view parsetree it needs to store into pg_rewrite when creating a
materialized view. Do the latter by having parse analysis stick a copy
into the IntoClause, instead of doing it at runtime. (On the whole,
I seriously question the choice to represent CREATE MATERIALIZED VIEW as a
variant of SELECT INTO/CREATE TABLE AS, because that means injecting even
more complexity into what was already a horrid legacy kluge. However,
I didn't go so far as to rethink that choice ... yet.)
I also moved several error checks into matview parse analysis, and
made the check for external Params in a matview more accurate.
In passing, clean things up a bit more around interpretOidsOption(),
and fix things so that we can use that to force no-oids for views,
sequences, etc, thereby eliminating the need to cons up "oids = false"
options when creating them.
catversion bump due to change in IntoClause. (I wonder though if we
really need readfuncs/outfuncs support for IntoClause anymore.)
2013-04-12 19:25:20 -04:00
|
|
|
extern bool isQueryUsingTempRelation(Query *query);
|
2001-10-28 01:26:15 -05:00
|
|
|
|
2001-11-05 12:46:40 -05:00
|
|
|
#endif /* PARSE_RELATION_H */
|