Commit f59a46a8 authored by Bruce Momjian's avatar Bruce Momjian

Parser Overhaul

parent 1dfe4eae
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.2 1996/08/28 07:16:17 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.3 1996/10/30 02:01:45 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -690,10 +690,12 @@ tg_parseTeeNode(TgRecipe *r, ...@@ -690,10 +690,12 @@ tg_parseTeeNode(TgRecipe *r,
same Tee. */ same Tee. */
if (rt_ind == 0) { if (rt_ind == 0) {
orig->rtable = lappend(orig->rtable, orig->rtable = lappend(orig->rtable,
makeRangeTableEntry(tt, addRangeTableEntry(NULL,
tt,
tt,
FALSE, FALSE,
NULL, FALSE,
tt)); NULL));
rt_ind = length(orig->rtable); rt_ind = length(orig->rtable);
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.1.1.1 1996/07/09 06:21:22 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.2 1996/10/30 02:01:47 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -235,9 +235,11 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse) ...@@ -235,9 +235,11 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
* CURRENT first, then NEW.... * CURRENT first, then NEW....
*/ */
rt_entry1 = rt_entry1 =
makeRangeTableEntry((char*)viewName, FALSE, NULL, "*CURRENT*"); addRangeTableEntry(NULL, (char*)viewName, "*CURRENT*",
FALSE, FALSE, NULL);
rt_entry2 = rt_entry2 =
makeRangeTableEntry((char*)viewName, FALSE, NULL, "*NEW*"); addRangeTableEntry(NULL, (char*)viewName, "*NEW*",
FALSE, FALSE, NULL);
new_rt = lcons(rt_entry2, old_rt); new_rt = lcons(rt_entry2, old_rt);
new_rt = lcons(rt_entry1, new_rt); new_rt = lcons(rt_entry1, new_rt);
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.12 1996/09/20 08:34:14 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.13 1996/10/30 02:01:54 momjian Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -124,7 +124,7 @@ static Node *makeA_Expr(int op, char *opname, Node *lexpr, Node *rexpr); ...@@ -124,7 +124,7 @@ static Node *makeA_Expr(int op, char *opname, Node *lexpr, Node *rexpr);
tableElementList, OptInherit, definition, tableElementList, OptInherit, definition,
opt_with_func, def_args, def_name_list, func_argtypes, opt_with_func, def_args, def_name_list, func_argtypes,
oper_argtypes, OptStmtList, OptStmtBlock, opt_column_list, columnList, oper_argtypes, OptStmtList, OptStmtBlock, opt_column_list, columnList,
exprList, sort_clause, sortby_list, index_params, sort_clause, sortby_list, index_params,
name_list, from_clause, from_list, opt_array_bounds, nest_array_bounds, name_list, from_clause, from_list, opt_array_bounds, nest_array_bounds,
expr_list, attrs, res_target_list, res_target_list2, def_list, expr_list, attrs, res_target_list, res_target_list2, def_list,
opt_indirection, group_clause, groupby_list, explain_options opt_indirection, group_clause, groupby_list, explain_options
...@@ -143,7 +143,7 @@ static Node *makeA_Expr(int op, char *opname, Node *lexpr, Node *rexpr); ...@@ -143,7 +143,7 @@ static Node *makeA_Expr(int op, char *opname, Node *lexpr, Node *rexpr);
%type <typnam> Typename, typname, opt_type %type <typnam> Typename, typname, opt_type
%type <coldef> columnDef %type <coldef> columnDef
%type <defelt> def_elem %type <defelt> def_elem
%type <node> def_arg, columnElem, exprElem, where_clause, %type <node> def_arg, columnElem, where_clause,
a_expr, AexprConst, having_clause, groupby a_expr, AexprConst, having_clause, groupby
%type <value> NumConst %type <value> NumConst
%type <attr> event_object, attr %type <attr> event_object, attr
...@@ -1244,17 +1244,17 @@ AppendStmt: INSERT INTO relation_name opt_column_list insert_rest ...@@ -1244,17 +1244,17 @@ AppendStmt: INSERT INTO relation_name opt_column_list insert_rest
} }
; ;
insert_rest: VALUES '(' exprList ')' insert_rest: VALUES '(' res_target_list2 ')'
{ {
$$ = makeNode(AppendStmt); $$ = makeNode(AppendStmt);
$$->exprs = $3; $$->targetList = $3;
$$->fromClause = NIL; $$->fromClause = NIL;
$$->whereClause = NULL; $$->whereClause = NULL;
} }
| SELECT exprList from_clause where_clause | SELECT res_target_list2 from_clause where_clause
{ {
$$ = makeNode(AppendStmt); $$ = makeNode(AppendStmt);
$$->exprs = $2; $$->targetList = $2;
$$->fromClause = $3; $$->fromClause = $3;
$$->whereClause = $4; $$->whereClause = $4;
} }
...@@ -1280,36 +1280,6 @@ columnElem: Id opt_indirection ...@@ -1280,36 +1280,6 @@ columnElem: Id opt_indirection
} }
; ;
exprList: exprList ',' exprElem
{ $$ = lappend($1, $3); }
| exprElem
{ $$ = lcons($1, NIL); }
;
exprElem: a_expr
{ $$ = (Node *)$1; }
| relation_name '.' '*'
{
Attr *n = makeNode(Attr);
n->relname = $1;
n->paramNo = NULL;
n->attrs = lcons(makeString("*"), NIL);
n->indirection = NIL;
$$ = (Node *)n;
}
| '*'
{
Attr *n = makeNode(Attr);
n->relname = "*";
n->paramNo = NULL;
n->attrs = NIL;
n->indirection = NIL;
$$ = (Node *)n;
}
;
/***************************************************************************** /*****************************************************************************
* *
* QUERY: * QUERY:
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: parsenodes.h,v 1.3 1996/10/19 04:49:29 scrappy Exp $ * $Id: parsenodes.h,v 1.4 1996/10/30 02:02:08 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -422,8 +422,7 @@ typedef struct AppendStmt { ...@@ -422,8 +422,7 @@ typedef struct AppendStmt {
NodeTag type; NodeTag type;
char *relname; /* relation to insert into */ char *relname; /* relation to insert into */
List *cols; /* names of the columns */ List *cols; /* names of the columns */
List *exprs; /* the expressions (same order as List *targetList; /* the target list (of ResTarget) */
the columns) */
List *fromClause; /* the from clause */ List *fromClause; /* the from clause */
Node *whereClause; /* qualifications */ Node *whereClause; /* qualifications */
} AppendStmt; } AppendStmt;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: parse_state.h,v 1.3 1996/10/13 17:13:58 momjian Exp $ * $Id: parse_state.h,v 1.4 1996/10/30 02:02:13 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -15,12 +15,15 @@ ...@@ -15,12 +15,15 @@
/* state information used during parse analysis */ /* state information used during parse analysis */
typedef struct ParseState { typedef struct ParseState {
int p_last_resno; int p_last_resno;
List *p_target_resnos;
Relation p_current_rel;
List *p_rtable; List *p_rtable;
int p_query_is_rule;
int p_numAgg; int p_numAgg;
List *p_aggs; List *p_aggs;
bool p_is_insert;
List *p_insert_columns;
bool p_is_update;
bool p_is_rule;
Relation p_target_relation;
RangeTblEntry *p_target_rangetblentry;
} ParseState; } ParseState;
......
...@@ -4761,7 +4761,7 @@ QUERY: CLOSE foo23; ...@@ -4761,7 +4761,7 @@ QUERY: CLOSE foo23;
QUERY: CLOSE foo24; QUERY: CLOSE foo24;
QUERY: CLOSE foo25; QUERY: CLOSE foo25;
QUERY: END; QUERY: END;
QUERY: PURGE hash_f8_heap BEFORE 'now'; -- absolute time QUERY: PURGE hash_f8_heap BEFORE 'now';
SELECT count(*) AS has_10002 FROM hash_f8_heap[,] h; SELECT count(*) AS has_10002 FROM hash_f8_heap[,] h;
QUERY: VACUUM hash_f8_heap; QUERY: VACUUM hash_f8_heap;
QUERY: SELECT count(*) AS has_10000 FROM hash_f8_heap[,] h; QUERY: SELECT count(*) AS has_10000 FROM hash_f8_heap[,] h;
...@@ -4770,7 +4770,7 @@ has_10000 ...@@ -4770,7 +4770,7 @@ has_10000
10002 10002
(1 row) (1 row)
QUERY: PURGE hash_i4_heap AFTER '@ 1 second ago'; -- relative time QUERY: PURGE hash_i4_heap AFTER '@ 1 second ago';
SELECT count(*) AS has_10002 FROM hash_i4_heap[,] h; SELECT count(*) AS has_10002 FROM hash_i4_heap[,] h;
QUERY: VACUUM hash_i4_heap; QUERY: VACUUM hash_i4_heap;
QUERY: SELECT count(*) AS has_10000 FROM hash_i4_heap[,] h; QUERY: SELECT count(*) AS has_10000 FROM hash_i4_heap[,] h;
......
-- --
-- queries.source -- queries.source
-- --
-- $Header: /cvsroot/pgsql/src/test/regress/Attic/queries.source,v 1.2 1996/10/07 02:33:25 momjian Exp $ -- $Header: /cvsroot/pgsql/src/test/regress/Attic/queries.source,v 1.3 1996/10/30 02:02:39 momjian Exp $
-- --
-- The comments that contain sequences of UNIX commands generate the -- The comments that contain sequences of UNIX commands generate the
-- desired output for the POSTQUEL statement(s). -- desired output for the POSTQUEL statement(s).
...@@ -721,7 +721,7 @@ SELECT '' AS three, f.f1, f.f1 * '-10' AS x FROM FLOAT4_TBL f ...@@ -721,7 +721,7 @@ SELECT '' AS three, f.f1, f.f1 * '-10' AS x FROM FLOAT4_TBL f
WHERE f.f1 > '0.0'; WHERE f.f1 > '0.0';
SELECT '' AS three, f.f1, f.f1 + '-10' AS x FROM FLOAT4_TBL f SELECT '' AS three, f.f1, f.f1 + '-10' AS x FROM FLOAT4_TBL f
WHERE f.f1 > '0.0' WHERE f.f1 > '0.0';
SELECT '' AS three, f.f1, f.f1 / '-10' AS x FROM FLOAT4_TBL f SELECT '' AS three, f.f1, f.f1 / '-10' AS x FROM FLOAT4_TBL f
WHERE f.f1 > '0.0'; WHERE f.f1 > '0.0';
...@@ -2195,7 +2195,8 @@ END; ...@@ -2195,7 +2195,8 @@ END;
-- miss deleting a bunch of index tuples, which caused big problems when -- miss deleting a bunch of index tuples, which caused big problems when
-- you dereferenced the tids and found garbage.. -- you dereferenced the tids and found garbage..
-- --
PURGE hash_f8_heap BEFORE 'now'; -- absolute time -- absolute time
PURGE hash_f8_heap BEFORE 'now';
SELECT count(*) AS has_10002 FROM hash_f8_heap[,] h; SELECT count(*) AS has_10002 FROM hash_f8_heap[,] h;
...@@ -2203,7 +2204,8 @@ VACUUM hash_f8_heap; ...@@ -2203,7 +2204,8 @@ VACUUM hash_f8_heap;
SELECT count(*) AS has_10000 FROM hash_f8_heap[,] h; SELECT count(*) AS has_10000 FROM hash_f8_heap[,] h;
PURGE hash_i4_heap AFTER '@ 1 second ago'; -- relative time -- relative time
PURGE hash_i4_heap AFTER '@ 1 second ago';
SELECT count(*) AS has_10002 FROM hash_i4_heap[,] h; SELECT count(*) AS has_10002 FROM hash_i4_heap[,] h;
......
#!/bin/sh #!/bin/sh
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.1.1.1 1996/07/09 06:22:24 scrappy Exp $ # $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.2 1996/10/30 02:02:41 momjian Exp $
# #
if [ -d ./obj ]; then if [ -d ./obj ]; then
cd ./obj cd ./obj
fi fi
TZ="PST8PDT"; export TZ
#FRONTEND=monitor #FRONTEND=monitor
FRONTEND="psql -n -e -q" FRONTEND="psql -n -e -q"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment