summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2002-03-22 02:56:37 +0000
committerTom Lane2002-03-22 02:56:37 +0000
commit108a0ec87d41393c362c5b8d8aa17d9a734e4f1a (patch)
treef437cf9d8bb1db8fdacf1c1022eac0f11e146069 /src/include
parent56c9b73c1d426c79a604df6d6f36293dd9f18754 (diff)
A little further progress on schemas: push down RangeVars into
addRangeTableEntry calls. Remove relname field from RTEs, since it will no longer be a useful unique identifier of relations; we want to encourage people to rely on the relation OID instead. Further work on dumping qual expressions in EXPLAIN, too.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/commands/creatinh.h4
-rw-r--r--src/include/nodes/makefuncs.h4
-rw-r--r--src/include/nodes/nodes.h3
-rw-r--r--src/include/nodes/parsenodes.h22
-rw-r--r--src/include/parser/parse_clause.h4
-rw-r--r--src/include/parser/parse_relation.h11
-rw-r--r--src/include/utils/builtins.h5
-rw-r--r--src/include/utils/lsyscache.h3
9 files changed, 27 insertions, 33 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 5e0fa208cf8..e931772b07c 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catversion.h,v 1.108 2002/03/21 16:01:39 tgl Exp $
+ * $Id: catversion.h,v 1.109 2002/03/22 02:56:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200203211
+#define CATALOG_VERSION_NO 200203212
#endif
diff --git a/src/include/commands/creatinh.h b/src/include/commands/creatinh.h
index 4cc9801e85e..90f5df63d33 100644
--- a/src/include/commands/creatinh.h
+++ b/src/include/commands/creatinh.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: creatinh.h,v 1.18 2002/03/19 02:58:20 momjian Exp $
+ * $Id: creatinh.h,v 1.19 2002/03/22 02:56:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@
#include "nodes/parsenodes.h"
-extern void DefineRelation(CreateStmt *stmt, char relkind);
+extern Oid DefineRelation(CreateStmt *stmt, char relkind);
extern void RemoveRelation(const char *name);
extern void TruncateRelation(const char *name);
diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h
index 2de7c03cf6a..52c224b18f9 100644
--- a/src/include/nodes/makefuncs.h
+++ b/src/include/nodes/makefuncs.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: makefuncs.h,v 1.32 2002/03/21 16:01:43 tgl Exp $
+ * $Id: makefuncs.h,v 1.33 2002/03/22 02:56:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,4 +48,6 @@ extern Alias *makeAlias(const char *aliasname, List *colnames);
extern RelabelType *makeRelabelType(Node *arg, Oid rtype, int32 rtypmod);
+extern RangeVar *makeRangeVar(char *schemaname, char *relname);
+
#endif /* MAKEFUNC_H */
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 95aba8dfaa4..34510c0d792 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodes.h,v 1.102 2002/03/21 16:01:44 tgl Exp $
+ * $Id: nodes.h,v 1.103 2002/03/22 02:56:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -153,7 +153,6 @@ typedef enum NodeTag
T_ClusterStmt,
T_CopyStmt,
T_CreateStmt,
- T_VersionStmt,
T_DefineStmt,
T_DropStmt,
T_TruncateStmt,
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 4f5d139011f..883130f90a0 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.163 2002/03/21 16:01:46 tgl Exp $
+ * $Id: parsenodes.h,v 1.164 2002/03/22 02:56:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -475,7 +475,7 @@ typedef struct TargetEntry
* eref is the table reference name and column reference names (either
* real or aliases). Note that system columns (OID etc) are not included
* in the column list.
- * eref->relname is required to be present, and should generally be used
+ * eref->aliasname is required to be present, and should generally be used
* to identify the RTE for error messages etc.
*
* inh is TRUE for relation references that should be expanded to include
@@ -521,9 +521,8 @@ typedef struct RangeTblEntry
*/
/*
- * Fields valid for a plain relation RTE (else NULL/zero):
+ * Fields valid for a plain relation RTE (else zero):
*/
- char *relname; /* real name of the relation */
Oid relid; /* OID of the relation */
/*
@@ -532,7 +531,7 @@ typedef struct RangeTblEntry
Query *subquery; /* the sub-query */
/*
- * Fields valid for a join RTE (else NULL):
+ * Fields valid for a join RTE (else NULL/zero):
*
* joincoltypes/joincoltypmods identify the column datatypes of the
* join result. joinleftcols and joinrightcols identify the source
@@ -1058,19 +1057,6 @@ typedef struct CreateSeqStmt
} CreateSeqStmt;
/* ----------------------
- * Create Version Statement
- * ----------------------
- */
-typedef struct VersionStmt
-{
- NodeTag type;
- char *relname; /* the new relation */
- int direction; /* FORWARD | BACKWARD */
- char *fromRelname; /* relation to create a version */
- char *date; /* date of the snapshot */
-} VersionStmt;
-
-/* ----------------------
* Create {Operator|Type|Aggregate} Statement
* ----------------------
*/
diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h
index 36820ad4dff..3b97a800afb 100644
--- a/src/include/parser/parse_clause.h
+++ b/src/include/parser/parse_clause.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_clause.h,v 1.27 2001/11/05 17:46:34 momjian Exp $
+ * $Id: parse_clause.h,v 1.28 2002/03/22 02:56:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,7 +17,7 @@
#include "parser/parse_node.h"
extern void transformFromClause(ParseState *pstate, List *frmList);
-extern int setTargetTable(ParseState *pstate, char *relname,
+extern int setTargetTable(ParseState *pstate, RangeVar *relation,
bool inh, bool alsoSource);
extern bool interpretInhOption(InhOption inhOpt);
extern Node *transformWhereClause(ParseState *pstate, Node *where);
diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h
index 656c70a688a..038931d9b6d 100644
--- a/src/include/parser/parse_relation.h
+++ b/src/include/parser/parse_relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_relation.h,v 1.30 2002/03/21 16:02:05 tgl Exp $
+ * $Id: parse_relation.h,v 1.31 2002/03/22 02:56:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,12 @@ extern Node *colnameToVar(ParseState *pstate, char *colname);
extern Node *qualifiedNameToVar(ParseState *pstate, char *refname,
char *colname, bool implicitRTEOK);
extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
- char *relname,
+ RangeVar *relation,
+ Alias *alias,
+ bool inh,
+ bool inFromCl);
+extern RangeTblEntry *addRangeTableEntryForRelation(ParseState *pstate,
+ Oid relid,
Alias *alias,
bool inh,
bool inFromCl);
@@ -47,7 +52,7 @@ extern RangeTblEntry *addRangeTableEntryForJoin(ParseState *pstate,
bool inFromCl);
extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte,
bool addToJoinList, bool addToNameSpace);
-extern RangeTblEntry *addImplicitRTE(ParseState *pstate, char *relname);
+extern RangeTblEntry *addImplicitRTE(ParseState *pstate, RangeVar *relation);
extern void expandRTE(ParseState *pstate, RangeTblEntry *rte,
List **colnames, List **colvars);
extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte);
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 4c2dec5d106..e1343bf4fcd 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.172 2002/03/12 00:52:06 tgl Exp $
+ * $Id: builtins.h,v 1.173 2002/03/22 02:56:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -342,9 +342,10 @@ extern Datum pg_get_userbyid(PG_FUNCTION_ARGS);
extern Datum pg_get_expr(PG_FUNCTION_ARGS);
extern char *deparse_expression(Node *expr, List *dpcontext,
bool forceprefix);
-extern List *deparse_context_for(char *relname, Oid relid);
+extern List *deparse_context_for(const char *aliasname, Oid relid);
extern List *deparse_context_for_plan(int outer_varno, Node *outercontext,
int inner_varno, Node *innercontext);
+extern Node *deparse_context_for_relation(const char *aliasname, Oid relid);
extern Node *deparse_context_for_subplan(const char *name, List *tlist,
List *rtable);
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index fbdb5f66346..89dda37bf7c 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: lsyscache.h,v 1.44 2002/03/20 19:45:09 tgl Exp $
+ * $Id: lsyscache.h,v 1.45 2002/03/22 02:56:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,6 +40,7 @@ extern RegProcedure get_oprjoin(Oid opno);
extern Oid get_func_rettype(Oid funcid);
extern bool func_iscachable(Oid funcid);
extern char *get_rel_name(Oid relid);
+extern Oid get_rel_type_id(Oid relid);
extern int16 get_typlen(Oid typid);
extern bool get_typbyval(Oid typid);
extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);