summaryrefslogtreecommitdiff
path: root/src/include/parser
diff options
context:
space:
mode:
authorTom Lane1999-07-19 00:26:20 +0000
committerTom Lane1999-07-19 00:26:20 +0000
commit7f76eab140e703b7847b107245a669e2010886c0 (patch)
tree8c9d01c654aa8de0e14c0d446817ba60c33d0199 /src/include/parser
parentc9814427722798751fa5bf254f597d722d76b5e3 (diff)
Rewrite parser's handling of INSERT ... SELECT so that processing
of the SELECT part of the statement is just like a plain SELECT. All INSERT-specific processing happens after the SELECT parsing is done. This eliminates many problems, e.g. INSERT ... SELECT ... GROUP BY using the wrong column labels. Ensure that DEFAULT clauses are coerced to the target column type, whether or not stored clause produces the right type. Substantial cleanup of parser's array support.
Diffstat (limited to 'src/include/parser')
-rw-r--r--src/include/parser/parse_clause.h8
-rw-r--r--src/include/parser/parse_expr.h8
-rw-r--r--src/include/parser/parse_node.h14
-rw-r--r--src/include/parser/parse_relation.h14
-rw-r--r--src/include/parser/parse_target.h25
5 files changed, 31 insertions, 38 deletions
diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h
index a50ab4e0391..3b1aafa07d9 100644
--- a/src/include/parser/parse_clause.h
+++ b/src/include/parser/parse_clause.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_clause.h,v 1.11 1999/07/15 23:04:01 momjian Exp $
+ * $Id: parse_clause.h,v 1.12 1999/07/19 00:26:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,8 +15,10 @@
#include "parser/parse_node.h"
-extern void makeRangeTable(ParseState *pstate, char *relname, List *frmList, Node **qual);
-extern Node *transformWhereClause(ParseState *pstate, Node *where, Node *using);
+extern void makeRangeTable(ParseState *pstate, List *frmList, Node **qual);
+extern void setTargetTable(ParseState *pstate, char *relname);
+extern Node *transformWhereClause(ParseState *pstate, Node *where,
+ Node *using);
extern List *transformGroupClause(ParseState *pstate, List *grouplist,
List *targetlist);
extern List *transformSortClause(ParseState *pstate,
diff --git a/src/include/parser/parse_expr.h b/src/include/parser/parse_expr.h
index cbc4095e330..3bd4d3fb47c 100644
--- a/src/include/parser/parse_expr.h
+++ b/src/include/parser/parse_expr.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
- * parse_exer.h
+ * parse_expr.h
*
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_expr.h,v 1.13 1999/07/15 23:04:02 momjian Exp $
+ * $Id: parse_expr.h,v 1.14 1999/07/19 00:26:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,8 +16,12 @@
#include "parser/parse_node.h"
#include "parser/parse_type.h"
+#define EXPR_COLUMN_FIRST 1
+#define EXPR_RELATION_FIRST 2
+
extern Node *transformExpr(ParseState *pstate, Node *expr, int precedence);
extern Oid exprType(Node *expr);
+extern int32 exprTypmod(Node *expr);
extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int32 attypmod);
#endif /* PARSE_EXPR_H */
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index 3dd2257db5e..1591743e064 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_node.h,v 1.14 1999/07/15 23:04:02 momjian Exp $
+ * $Id: parse_node.h,v 1.15 1999/07/19 00:26:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,7 +20,6 @@ typedef struct ParseState
{
int p_last_resno;
List *p_rtable;
- List *p_insert_columns;
struct ParseState *parentParseState;
bool p_hasAggs;
bool p_hasSubLinks;
@@ -36,12 +35,11 @@ extern ParseState *make_parsestate(ParseState *parentParseState);
extern Expr *make_op(char *opname, Node *ltree, Node *rtree);
extern Var *make_var(ParseState *pstate, Oid relid, char *refname,
char *attrname);
-extern ArrayRef *make_array_ref(Node *expr,
- List *indirection);
-extern ArrayRef *make_array_set(Expr *target_expr,
- List *upperIndexpr,
- List *lowerIndexpr,
- Expr *expr);
+extern ArrayRef *transformArraySubscripts(ParseState *pstate,
+ Node *arrayBase,
+ List *indirection,
+ bool forceSlice,
+ Node *assignFrom);
extern Const *make_const(Value *value);
#endif /* PARSE_NODE_H */
diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h
index e44f89c79ba..68e5ac7bf17 100644
--- a/src/include/parser/parse_relation.h
+++ b/src/include/parser/parse_relation.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
- * parse_query.h
- * prototypes for parse_query.c.
+ * parse_relation.h
+ * prototypes for parse_relation.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_relation.h,v 1.11 1999/07/15 23:04:03 momjian Exp $
+ * $Id: parse_relation.h,v 1.12 1999/07/19 00:26:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
-#ifndef PARSE_QUERY_H
-#define PARSE_RANGE_H
+#ifndef PARSE_RELATION_H
+#define PARSE_RELATION_H
#include "parser/parse_node.h"
@@ -30,7 +30,5 @@ extern int attnameAttNum(Relation rd, char *a);
extern bool attnameIsSet(Relation rd, char *name);
extern int attnumAttNelems(Relation rd, int attid);
extern Oid attnumTypeId(Relation rd, int attid);
-extern void handleTargetColname(ParseState *pstate, char **resname,
- char *refname, char *colname);
-#endif /* PARSE_RANGE_H */
+#endif /* PARSE_RELATION_H */
diff --git a/src/include/parser/parse_target.h b/src/include/parser/parse_target.h
index bd520d1bab9..c2babecb769 100644
--- a/src/include/parser/parse_target.h
+++ b/src/include/parser/parse_target.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_target.h,v 1.14 1999/07/15 23:04:03 momjian Exp $
+ * $Id: parse_target.h,v 1.15 1999/07/19 00:26:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,23 +15,14 @@
#include "parser/parse_node.h"
-#define EXPR_COLUMN_FIRST 1
-#define EXPR_RELATION_FIRST 2
-
extern List *transformTargetList(ParseState *pstate, List *targetlist);
-extern List *makeTargetNames(ParseState *pstate, List *cols);
-extern TargetEntry *MakeTargetEntryIdent(ParseState *pstate,
- Node *node,
- char **resname,
- char *refname,
- char *colname,
- bool resjunk);
+extern TargetEntry *transformTargetEntry(ParseState *pstate,
+ Node *node, Node *expr,
+ char *colname, bool resjunk);
+extern void updateTargetListEntry(ParseState *pstate, TargetEntry *tle,
+ char *colname, List *indirection);
extern Node *CoerceTargetExpr(ParseState *pstate, Node *expr,
- Oid type_id, Oid attrtype);
-TargetEntry *MakeTargetEntryExpr(ParseState *pstate,
- char *colname,
- Node *expr,
- List *arrayRef,
- bool resjunk);
+ Oid type_id, Oid attrtype);
+extern List *makeTargetNames(ParseState *pstate, List *cols);
#endif /* PARSE_TARGET_H */