Commit c5ba16a8 authored by Tom Lane's avatar Tom Lane

Get rid of last few vestiges of parsetree dependency on grammar token

codes, per discussion from last March.  parse.h should now be included
*only* by gram.y, scan.l, keywords.c, parser.c.  This prevents surprising
misbehavior after seemingly-trivial grammar adjustments.
parent b5956a2f
......@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.242 2003/02/09 06:56:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.243 2003/02/10 04:44:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1198,7 +1198,7 @@ _copyAExpr(A_Expr *from)
{
A_Expr *newnode = makeNode(A_Expr);
COPY_SCALAR_FIELD(oper);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(name);
COPY_NODE_FIELD(lexpr);
COPY_NODE_FIELD(rexpr);
......@@ -1669,7 +1669,7 @@ _copyDefineStmt(DefineStmt *from)
{
DefineStmt *newnode = makeNode(DefineStmt);
COPY_SCALAR_FIELD(defType);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(defnames);
COPY_NODE_FIELD(definition);
......@@ -1869,7 +1869,7 @@ _copyTransactionStmt(TransactionStmt *from)
{
TransactionStmt *newnode = makeNode(TransactionStmt);
COPY_SCALAR_FIELD(command);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(options);
return newnode;
......@@ -2215,7 +2215,7 @@ _copyReindexStmt(ReindexStmt *from)
{
ReindexStmt *newnode = makeNode(ReindexStmt);
COPY_SCALAR_FIELD(reindexType);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(relation);
COPY_STRING_FIELD(name);
COPY_SCALAR_FIELD(force);
......
......@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.185 2003/02/09 06:56:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.186 2003/02/10 04:44:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -730,7 +730,7 @@ _equalCreateStmt(CreateStmt *a, CreateStmt *b)
static bool
_equalDefineStmt(DefineStmt *a, DefineStmt *b)
{
COMPARE_SCALAR_FIELD(defType);
COMPARE_SCALAR_FIELD(kind);
COMPARE_NODE_FIELD(defnames);
COMPARE_NODE_FIELD(definition);
......@@ -898,7 +898,7 @@ _equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
static bool
_equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
{
COMPARE_SCALAR_FIELD(command);
COMPARE_SCALAR_FIELD(kind);
COMPARE_NODE_FIELD(options);
return true;
......@@ -1187,7 +1187,7 @@ _equalDropGroupStmt(DropGroupStmt *a, DropGroupStmt *b)
static bool
_equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
{
COMPARE_SCALAR_FIELD(reindexType);
COMPARE_SCALAR_FIELD(kind);
COMPARE_NODE_FIELD(relation);
COMPARE_STRING_FIELD(name);
COMPARE_SCALAR_FIELD(force);
......@@ -1276,7 +1276,7 @@ _equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b)
static bool
_equalAExpr(A_Expr *a, A_Expr *b)
{
COMPARE_SCALAR_FIELD(oper);
COMPARE_SCALAR_FIELD(kind);
COMPARE_NODE_FIELD(name);
COMPARE_NODE_FIELD(lexpr);
COMPARE_NODE_FIELD(rexpr);
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.37 2002/12/12 15:49:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.38 2003/02/10 04:44:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -24,11 +24,11 @@
* makes an A_Expr node
*/
A_Expr *
makeA_Expr(int oper, List *name, Node *lexpr, Node *rexpr)
makeA_Expr(A_Expr_Kind kind, List *name, Node *lexpr, Node *rexpr)
{
A_Expr *a = makeNode(A_Expr);
a->oper = oper;
a->kind = kind;
a->name = name;
a->lexpr = lexpr;
a->rexpr = rexpr;
......@@ -40,12 +40,12 @@ makeA_Expr(int oper, List *name, Node *lexpr, Node *rexpr)
* As above, given a simple (unqualified) operator name
*/
A_Expr *
makeSimpleA_Expr(int oper, const char *name,
makeSimpleA_Expr(A_Expr_Kind kind, const char *name,
Node *lexpr, Node *rexpr)
{
A_Expr *a = makeNode(A_Expr);
a->oper = oper;
a->kind = kind;
a->name = makeList1(makeString((char *) name));
a->lexpr = lexpr;
a->rexpr = rexpr;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.198 2003/02/09 06:56:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.199 2003/02/10 04:44:45 tgl Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
......@@ -27,7 +27,6 @@
#include "nodes/parsenodes.h"
#include "nodes/plannodes.h"
#include "nodes/relation.h"
#include "parser/parse.h"
#include "utils/datum.h"
......@@ -1259,19 +1258,27 @@ _outAExpr(StringInfo str, A_Expr *node)
{
WRITE_NODE_TYPE("AEXPR");
switch (node->oper)
switch (node->kind)
{
case AND:
case AEXPR_OP:
appendStringInfo(str, " ");
WRITE_NODE_FIELD(name);
break;
case AEXPR_AND:
appendStringInfo(str, " AND");
break;
case OR:
case AEXPR_OR:
appendStringInfo(str, " OR");
break;
case NOT:
case AEXPR_NOT:
appendStringInfo(str, " NOT");
break;
case OP:
appendStringInfo(str, " ");
case AEXPR_DISTINCT:
appendStringInfo(str, " DISTINCT ");
WRITE_NODE_FIELD(name);
break;
case AEXPR_OF:
appendStringInfo(str, " OF ");
WRITE_NODE_FIELD(name);
break;
default:
......
......@@ -2,7 +2,7 @@
#
# Makefile for parser
#
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.39 2003/01/31 20:58:00 tgl Exp $
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.40 2003/02/10 04:44:45 tgl Exp $
#
#-------------------------------------------------------------------------
......@@ -64,7 +64,7 @@ endif
# Force these dependencies to be known even without dependency info built:
keywords.o parse_clause.o parse_expr.o parser.o gram.o: $(srcdir)/parse.h
gram.o keywords.o parser.o: $(srcdir)/parse.h
# gram.c, parse.h, and scan.c are in the distribution tarball, so they
......
......@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.400 2003/02/09 06:56:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.401 2003/02/10 04:44:45 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
......@@ -324,11 +324,11 @@ static void doNegateFloat(Value *v);
*/
/* ordinary key words in alphabetical order */
%token <keyword> ABORT_TRANS ABSOLUTE ACCESS ACTION ADD AFTER
%token <keyword> ABORT_P ABSOLUTE ACCESS ACTION ADD AFTER
AGGREGATE ALL ALTER ANALYSE ANALYZE AND ANY AS ASC
ASSERTION ASSIGNMENT AT AUTHORIZATION
BACKWARD BEFORE BEGIN_TRANS BETWEEN BIGINT BINARY BIT
BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
BOOLEAN BOTH BY
CACHE CALLED CASCADE CASE CAST CHAIN CHAR_P
......@@ -342,13 +342,13 @@ static void doNegateFloat(Value *v);
DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS
DESC DISTINCT DO DOMAIN_P DOUBLE DROP
EACH ELSE ENCODING ENCRYPTED END_TRANS ESCAPE EXCEPT
EACH ELSE ENCODING ENCRYPTED END_P ESCAPE EXCEPT
EXCLUSIVE EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
FALSE_P FETCH FLOAT_P FOR FORCE FOREIGN FORWARD
FREEZE FROM FULL FUNCTION
GET GLOBAL GRANT GROUP_P
GLOBAL GRANT GROUP_P
HANDLER HAVING HOUR_P
......@@ -414,9 +414,6 @@ static void doNegateFloat(Value *v);
%token <str> IDENT FCONST SCONST NCONST BCONST XCONST Op
%token <ival> ICONST PARAM
/* these are not real. they are here so that they get generated as #define's*/
%token OP
/* precedence: lowest to highest */
%left UNION EXCEPT
%left INTERSECT
......@@ -2234,7 +2231,7 @@ DefineStmt:
CREATE AGGREGATE func_name definition
{
DefineStmt *n = makeNode(DefineStmt);
n->defType = AGGREGATE;
n->kind = DEFINE_STMT_AGGREGATE;
n->defnames = $3;
n->definition = $4;
$$ = (Node *)n;
......@@ -2242,7 +2239,7 @@ DefineStmt:
| CREATE OPERATOR any_operator definition
{
DefineStmt *n = makeNode(DefineStmt);
n->defType = OPERATOR;
n->kind = DEFINE_STMT_OPERATOR;
n->defnames = $3;
n->definition = $4;
$$ = (Node *)n;
......@@ -2250,7 +2247,7 @@ DefineStmt:
| CREATE TYPE_P any_name definition
{
DefineStmt *n = makeNode(DefineStmt);
n->defType = TYPE_P;
n->kind = DEFINE_STMT_TYPE;
n->defnames = $3;
n->definition = $4;
$$ = (Node *)n;
......@@ -2288,14 +2285,6 @@ DefineStmt:
n->coldeflist = $6;
$$ = (Node *)n;
}
| CREATE CHARACTER SET opt_as any_name GET definition opt_collate
{
DefineStmt *n = makeNode(DefineStmt);
n->defType = CHARACTER;
n->defnames = $5;
n->definition = $7;
$$ = (Node *)n;
}
;
definition: '(' def_list ')' { $$ = $2; }
......@@ -2586,7 +2575,7 @@ FetchStmt: FETCH direction fetch_how_many from_in name
if ($3 < 0)
{
$3 = -$3;
$2 = (($2 == FORWARD) ? BACKWARD : FORWARD);
$2 = (($2 == FETCH_FORWARD) ? FETCH_BACKWARD : FETCH_FORWARD);
}
n->direction = $2;
n->howMany = $3;
......@@ -2600,11 +2589,11 @@ FetchStmt: FETCH direction fetch_how_many from_in name
if ($2 < 0)
{
n->howMany = -$2;
n->direction = BACKWARD;
n->direction = FETCH_BACKWARD;
}
else
{
n->direction = FORWARD;
n->direction = FETCH_FORWARD;
n->howMany = $2;
}
n->portalname = $4;
......@@ -2623,7 +2612,7 @@ FetchStmt: FETCH direction fetch_how_many from_in name
| FETCH from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FORWARD;
n->direction = FETCH_FORWARD;
n->howMany = 1;
n->portalname = $3;
n->ismove = FALSE;
......@@ -2632,7 +2621,7 @@ FetchStmt: FETCH direction fetch_how_many from_in name
| FETCH name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FORWARD;
n->direction = FETCH_FORWARD;
n->howMany = 1;
n->portalname = $2;
n->ismove = FALSE;
......@@ -2644,7 +2633,7 @@ FetchStmt: FETCH direction fetch_how_many from_in name
if ($3 < 0)
{
$3 = -$3;
$2 = (($2 == FORWARD) ? BACKWARD : FORWARD);
$2 = (($2 == FETCH_FORWARD) ? FETCH_BACKWARD : FETCH_FORWARD);
}
n->direction = $2;
n->howMany = $3;
......@@ -2658,11 +2647,11 @@ FetchStmt: FETCH direction fetch_how_many from_in name
if ($2 < 0)
{
n->howMany = -$2;
n->direction = BACKWARD;
n->direction = FETCH_BACKWARD;
}
else
{
n->direction = FORWARD;
n->direction = FETCH_FORWARD;
n->howMany = $2;
}
n->portalname = $4;
......@@ -2681,7 +2670,7 @@ FetchStmt: FETCH direction fetch_how_many from_in name
| MOVE from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FORWARD;
n->direction = FETCH_FORWARD;
n->howMany = 1;
n->portalname = $3;
n->ismove = TRUE;
......@@ -2690,7 +2679,7 @@ FetchStmt: FETCH direction fetch_how_many from_in name
| MOVE name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FORWARD;
n->direction = FETCH_FORWARD;
n->howMany = 1;
n->portalname = $2;
n->ismove = TRUE;
......@@ -2698,14 +2687,14 @@ FetchStmt: FETCH direction fetch_how_many from_in name
}
;
direction: FORWARD { $$ = FORWARD; }
| BACKWARD { $$ = BACKWARD; }
| RELATIVE { $$ = FORWARD; }
direction: FORWARD { $$ = FETCH_FORWARD; }
| BACKWARD { $$ = FETCH_BACKWARD; }
| RELATIVE { $$ = FETCH_FORWARD; }
| ABSOLUTE
{
elog(NOTICE,
"FETCH / ABSOLUTE not supported, using RELATIVE");
$$ = FORWARD;
$$ = FETCH_FORWARD;
}
;
......@@ -3281,7 +3270,7 @@ ReindexStmt:
REINDEX reindex_type qualified_name opt_force
{
ReindexStmt *n = makeNode(ReindexStmt);
n->reindexType = $2;
n->kind = $2;
n->relation = $3;
n->name = NULL;
n->force = $4;
......@@ -3290,7 +3279,7 @@ ReindexStmt:
| REINDEX DATABASE name opt_force
{
ReindexStmt *n = makeNode(ReindexStmt);
n->reindexType = DATABASE;
n->kind = REINDEX_DATABASE;
n->name = $3;
n->relation = NULL;
n->force = $4;
......@@ -3299,8 +3288,8 @@ ReindexStmt:
;
reindex_type:
INDEX { $$ = INDEX; }
| TABLE { $$ = TABLE; }
INDEX { $$ = REINDEX_INDEX; }
| TABLE { $$ = REINDEX_TABLE; }
;
opt_force: FORCE { $$ = TRUE; }
......@@ -3485,45 +3474,45 @@ UnlistenStmt:
*****************************************************************************/
TransactionStmt:
ABORT_TRANS opt_transaction
ABORT_P opt_transaction
{
TransactionStmt *n = makeNode(TransactionStmt);
n->command = ROLLBACK;
n->kind = TRANS_STMT_ROLLBACK;
n->options = NIL;
$$ = (Node *)n;
}
| BEGIN_TRANS opt_transaction
| BEGIN_P opt_transaction
{
TransactionStmt *n = makeNode(TransactionStmt);
n->command = BEGIN_TRANS;
n->kind = TRANS_STMT_BEGIN;
n->options = NIL;
$$ = (Node *)n;
}
| START TRANSACTION transaction_mode_list_or_empty
{
TransactionStmt *n = makeNode(TransactionStmt);
n->command = START;
n->kind = TRANS_STMT_START;
n->options = $3;
$$ = (Node *)n;
}
| COMMIT opt_transaction
{
TransactionStmt *n = makeNode(TransactionStmt);
n->command = COMMIT;
n->kind = TRANS_STMT_COMMIT;
n->options = NIL;
$$ = (Node *)n;
}
| END_TRANS opt_transaction
| END_P opt_transaction
{
TransactionStmt *n = makeNode(TransactionStmt);
n->command = COMMIT;
n->kind = TRANS_STMT_COMMIT;
n->options = NIL;
$$ = (Node *)n;
}
| ROLLBACK opt_transaction
{
TransactionStmt *n = makeNode(TransactionStmt);
n->command = ROLLBACK;
n->kind = TRANS_STMT_ROLLBACK;
n->options = NIL;
$$ = (Node *)n;
}
......@@ -5467,7 +5456,7 @@ r_expr: row IN_P select_with_parens
n->operName = makeList1(makeString("="));
n->subselect = $4;
/* Stick a NOT on top */
$$ = (Node *) makeA_Expr(NOT, NIL, NULL, (Node *) n);
$$ = (Node *) makeA_Expr(AEXPR_NOT, NIL, NULL, (Node *) n);
}
| row qual_all_Op sub_type select_with_parens
%prec Op
......@@ -5629,52 +5618,52 @@ a_expr: c_expr { $$ = $1; }
* also to b_expr and to the MathOp list above.
*/
| '+' a_expr %prec UMINUS
{ $$ = (Node *) makeSimpleA_Expr(OP, "+", NULL, $2); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", NULL, $2); }
| '-' a_expr %prec UMINUS
{ $$ = doNegate($2); }
| '%' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "%", NULL, $2); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", NULL, $2); }
| '^' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "^", NULL, $2); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", NULL, $2); }
| a_expr '%'
{ $$ = (Node *) makeSimpleA_Expr(OP, "%", $1, NULL); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", $1, NULL); }
| a_expr '^'
{ $$ = (Node *) makeSimpleA_Expr(OP, "^", $1, NULL); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", $1, NULL); }
| a_expr '+' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "+", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", $1, $3); }
| a_expr '-' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "-", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "-", $1, $3); }
| a_expr '*' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "*", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "*", $1, $3); }
| a_expr '/' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "/", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "/", $1, $3); }
| a_expr '%' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "%", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", $1, $3); }
| a_expr '^' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "^", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", $1, $3); }
| a_expr '<' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "<", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "<", $1, $3); }
| a_expr '>' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, ">", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, ">", $1, $3); }
| a_expr '=' a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "=", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "=", $1, $3); }
| a_expr qual_Op a_expr %prec Op
{ $$ = (Node *) makeA_Expr(OP, $2, $1, $3); }
{ $$ = (Node *) makeA_Expr(AEXPR_OP, $2, $1, $3); }
| qual_Op a_expr %prec Op
{ $$ = (Node *) makeA_Expr(OP, $1, NULL, $2); }
{ $$ = (Node *) makeA_Expr(AEXPR_OP, $1, NULL, $2); }
| a_expr qual_Op %prec POSTFIXOP
{ $$ = (Node *) makeA_Expr(OP, $2, $1, NULL); }
{ $$ = (Node *) makeA_Expr(AEXPR_OP, $2, $1, NULL); }
| a_expr AND a_expr
{ $$ = (Node *) makeA_Expr(AND, NIL, $1, $3); }
{ $$ = (Node *) makeA_Expr(AEXPR_AND, NIL, $1, $3); }
| a_expr OR a_expr
{ $$ = (Node *) makeA_Expr(OR, NIL, $1, $3); }
{ $$ = (Node *) makeA_Expr(AEXPR_OR, NIL, $1, $3); }
| NOT a_expr
{ $$ = (Node *) makeA_Expr(NOT, NIL, NULL, $2); }
{ $$ = (Node *) makeA_Expr(AEXPR_NOT, NIL, NULL, $2); }
| a_expr LIKE a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "~~", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~", $1, $3); }
| a_expr LIKE a_expr ESCAPE a_expr
{
FuncCall *n = makeNode(FuncCall);
......@@ -5682,10 +5671,10 @@ a_expr: c_expr { $$ = $1; }
n->args = makeList2($3, $5);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) makeSimpleA_Expr(OP, "~~", $1, (Node *) n);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~", $1, (Node *) n);
}
| a_expr NOT LIKE a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "!~~", $1, $4); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~", $1, $4); }
| a_expr NOT LIKE a_expr ESCAPE a_expr
{
FuncCall *n = makeNode(FuncCall);
......@@ -5693,10 +5682,10 @@ a_expr: c_expr { $$ = $1; }
n->args = makeList2($4, $6);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) makeSimpleA_Expr(OP, "!~~", $1, (Node *) n);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~", $1, (Node *) n);
}
| a_expr ILIKE a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "~~*", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~*", $1, $3); }
| a_expr ILIKE a_expr ESCAPE a_expr
{
FuncCall *n = makeNode(FuncCall);
......@@ -5704,10 +5693,10 @@ a_expr: c_expr { $$ = $1; }
n->args = makeList2($3, $5);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) makeSimpleA_Expr(OP, "~~*", $1, (Node *) n);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~~*", $1, (Node *) n);
}
| a_expr NOT ILIKE a_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "!~~*", $1, $4); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~*", $1, $4); }
| a_expr NOT ILIKE a_expr ESCAPE a_expr
{
FuncCall *n = makeNode(FuncCall);
......@@ -5715,7 +5704,7 @@ a_expr: c_expr { $$ = $1; }
n->args = makeList2($4, $6);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) makeSimpleA_Expr(OP, "!~~*", $1, (Node *) n);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~~*", $1, (Node *) n);
}
| a_expr SIMILAR TO a_expr %prec SIMILAR
......@@ -5727,7 +5716,7 @@ a_expr: c_expr { $$ = $1; }
n->args = makeList2($4, (Node *) c);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) makeSimpleA_Expr(OP, "~", $1, (Node *) n);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $1, (Node *) n);
}
| a_expr SIMILAR TO a_expr ESCAPE a_expr
{
......@@ -5736,7 +5725,7 @@ a_expr: c_expr { $$ = $1; }
n->args = makeList2($4, $6);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) makeSimpleA_Expr(OP, "~", $1, (Node *) n);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $1, (Node *) n);
}
| a_expr NOT SIMILAR TO a_expr %prec SIMILAR
{
......@@ -5747,7 +5736,7 @@ a_expr: c_expr { $$ = $1; }
n->args = makeList2($5, (Node *) c);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) makeSimpleA_Expr(OP, "!~", $1, (Node *) n);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~", $1, (Node *) n);
}
| a_expr NOT SIMILAR TO a_expr ESCAPE a_expr
{
......@@ -5756,7 +5745,7 @@ a_expr: c_expr { $$ = $1; }
n->args = makeList2($5, $7);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) makeSimpleA_Expr(OP, "!~", $1, (Node *) n);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "!~", $1, (Node *) n);
}
/* NullTest clause
......@@ -5839,26 +5828,26 @@ a_expr: c_expr { $$ = $1; }
$$ = (Node *)b;
}
| a_expr IS DISTINCT FROM a_expr %prec IS
{ $$ = (Node *) makeSimpleA_Expr(DISTINCT, "=", $1, $5); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_DISTINCT, "=", $1, $5); }
| a_expr IS OF '(' type_list ')' %prec IS
{
$$ = (Node *) makeSimpleA_Expr(OF, "=", $1, (Node *) $5);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OF, "=", $1, (Node *) $5);
}
| a_expr IS NOT OF '(' type_list ')' %prec IS
{
$$ = (Node *) makeSimpleA_Expr(OF, "!=", $1, (Node *) $6);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OF, "!=", $1, (Node *) $6);
}
| a_expr BETWEEN b_expr AND b_expr %prec BETWEEN
{
$$ = (Node *) makeA_Expr(AND, NIL,
(Node *) makeSimpleA_Expr(OP, ">=", $1, $3),
(Node *) makeSimpleA_Expr(OP, "<=", $1, $5));
$$ = (Node *) makeA_Expr(AEXPR_AND, NIL,
(Node *) makeSimpleA_Expr(AEXPR_OP, ">=", $1, $3),
(Node *) makeSimpleA_Expr(AEXPR_OP, "<=", $1, $5));
}
| a_expr NOT BETWEEN b_expr AND b_expr %prec BETWEEN
{
$$ = (Node *) makeA_Expr(OR, NIL,
(Node *) makeSimpleA_Expr(OP, "<", $1, $4),
(Node *) makeSimpleA_Expr(OP, ">", $1, $6));
$$ = (Node *) makeA_Expr(AEXPR_OR, NIL,
(Node *) makeSimpleA_Expr(AEXPR_OP, "<", $1, $4),
(Node *) makeSimpleA_Expr(AEXPR_OP, ">", $1, $6));
}
| a_expr IN_P in_expr
{
......@@ -5878,11 +5867,11 @@ a_expr: c_expr { $$ = $1; }
foreach(l, (List *) $3)
{
Node *cmp;
cmp = (Node *) makeSimpleA_Expr(OP, "=", $1, lfirst(l));
cmp = (Node *) makeSimpleA_Expr(AEXPR_OP, "=", $1, lfirst(l));
if (n == NULL)
n = cmp;
else
n = (Node *) makeA_Expr(OR, NIL, n, cmp);
n = (Node *) makeA_Expr(AEXPR_OR, NIL, n, cmp);
}
$$ = n;
}
......@@ -5898,7 +5887,7 @@ a_expr: c_expr { $$ = $1; }
n->lefthand = makeList1($1);
n->operName = makeList1(makeString("="));
/* Stick a NOT on top */
$$ = (Node *) makeA_Expr(NOT, NIL, NULL, (Node *) n);
$$ = (Node *) makeA_Expr(AEXPR_NOT, NIL, NULL, (Node *) n);
}
else
{
......@@ -5907,11 +5896,11 @@ a_expr: c_expr { $$ = $1; }
foreach(l, (List *) $4)
{
Node *cmp;
cmp = (Node *) makeSimpleA_Expr(OP, "<>", $1, lfirst(l));
cmp = (Node *) makeSimpleA_Expr(AEXPR_OP, "<>", $1, lfirst(l));
if (n == NULL)
n = cmp;
else
n = (Node *) makeA_Expr(AND, NIL, n, cmp);
n = (Node *) makeA_Expr(AEXPR_AND, NIL, n, cmp);
}
$$ = n;
}
......@@ -5956,50 +5945,50 @@ b_expr: c_expr
| b_expr TYPECAST Typename
{ $$ = makeTypeCast($1, $3); }
| '+' b_expr %prec UMINUS
{ $$ = (Node *) makeSimpleA_Expr(OP, "+", NULL, $2); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", NULL, $2); }
| '-' b_expr %prec UMINUS
{ $$ = doNegate($2); }
| '%' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "%", NULL, $2); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", NULL, $2); }
| '^' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "^", NULL, $2); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", NULL, $2); }
| b_expr '%'
{ $$ = (Node *) makeSimpleA_Expr(OP, "%", $1, NULL); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", $1, NULL); }
| b_expr '^'
{ $$ = (Node *) makeSimpleA_Expr(OP, "^", $1, NULL); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", $1, NULL); }
| b_expr '+' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "+", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", $1, $3); }
| b_expr '-' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "-", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "-", $1, $3); }
| b_expr '*' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "*", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "*", $1, $3); }
| b_expr '/' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "/", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "/", $1, $3); }
| b_expr '%' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "%", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", $1, $3); }
| b_expr '^' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "^", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", $1, $3); }
| b_expr '<' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "<", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "<", $1, $3); }
| b_expr '>' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, ">", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, ">", $1, $3); }
| b_expr '=' b_expr
{ $$ = (Node *) makeSimpleA_Expr(OP, "=", $1, $3); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "=", $1, $3); }
| b_expr qual_Op b_expr %prec Op
{ $$ = (Node *) makeA_Expr(OP, $2, $1, $3); }
{ $$ = (Node *) makeA_Expr(AEXPR_OP, $2, $1, $3); }
| qual_Op b_expr %prec Op
{ $$ = (Node *) makeA_Expr(OP, $1, NULL, $2); }
{ $$ = (Node *) makeA_Expr(AEXPR_OP, $1, NULL, $2); }
| b_expr qual_Op %prec POSTFIXOP
{ $$ = (Node *) makeA_Expr(OP, $2, $1, NULL); }
{ $$ = (Node *) makeA_Expr(AEXPR_OP, $2, $1, NULL); }
| b_expr IS DISTINCT FROM b_expr %prec IS
{ $$ = (Node *) makeSimpleA_Expr(DISTINCT, "=", $1, $5); }
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_DISTINCT, "=", $1, $5); }
| b_expr IS OF '(' type_list ')' %prec IS
{
$$ = (Node *) makeSimpleA_Expr(OF, "=", $1, (Node *) $5);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OF, "=", $1, (Node *) $5);
}
| b_expr IS NOT OF '(' type_list ')' %prec IS
{
$$ = (Node *) makeSimpleA_Expr(OF, "!=", $1, (Node *) $6);
$$ = (Node *) makeSimpleA_Expr(AEXPR_OF, "!=", $1, (Node *) $6);
}
;
......@@ -6646,7 +6635,7 @@ in_expr: select_with_parens
* same as CASE WHEN a IS NOT NULL THEN a WHEN b IS NOT NULL THEN b ... END
* - thomas 1998-11-09
*/
case_expr: CASE case_arg when_clause_list case_default END_TRANS
case_expr: CASE case_arg when_clause_list case_default END_P
{
CaseExpr *c = makeNode(CaseExpr);
c->arg = (Expr *) $2;
......@@ -6659,7 +6648,7 @@ case_expr: CASE case_arg when_clause_list case_default END_TRANS
CaseExpr *c = makeNode(CaseExpr);
CaseWhen *w = makeNode(CaseWhen);
w->expr = (Expr *) makeSimpleA_Expr(OP, "=", $3, $5);
w->expr = (Expr *) makeSimpleA_Expr(AEXPR_OP, "=", $3, $5);
/* w->result is left NULL */
c->args = makeList1(w);
c->defresult = (Expr *) $3;
......@@ -7055,7 +7044,7 @@ ColLabel: IDENT { $$ = $1; }
/* "Unreserved" keywords --- available for use as any kind of name.
*/
unreserved_keyword:
ABORT_TRANS
ABORT_P
| ABSOLUTE
| ACCESS
| ACTION
......@@ -7068,7 +7057,7 @@ unreserved_keyword:
| AT
| BACKWARD
| BEFORE
| BEGIN_TRANS
| BEGIN_P
| BY
| CACHE
| CALLED
......@@ -7113,7 +7102,6 @@ unreserved_keyword:
| FORCE
| FORWARD
| FUNCTION
| GET
| GLOBAL
| HANDLER
| HOUR_P
......@@ -7345,7 +7333,7 @@ reserved_keyword:
| DISTINCT
| DO
| ELSE
| END_TRANS
| END_P
| EXCEPT
| FALSE_P
| FOR
......@@ -7541,19 +7529,19 @@ makeRowExpr(List *opr, List *largs, List *rargs)
(strcmp(oprname, ">=") == 0))
{
if (expr == NULL)
expr = (Node *) makeA_Expr(OP, opr, larg, rarg);
expr = (Node *) makeA_Expr(AEXPR_OP, opr, larg, rarg);
else
expr = (Node *) makeA_Expr(AND, NIL, expr,
(Node *) makeA_Expr(OP, opr,
expr = (Node *) makeA_Expr(AEXPR_AND, NIL, expr,
(Node *) makeA_Expr(AEXPR_OP, opr,
larg, rarg));
}
else if (strcmp(oprname, "<>") == 0)
{
if (expr == NULL)
expr = (Node *) makeA_Expr(OP, opr, larg, rarg);
expr = (Node *) makeA_Expr(AEXPR_OP, opr, larg, rarg);
else
expr = (Node *) makeA_Expr(OR, NIL, expr,
(Node *) makeA_Expr(OP, opr,
expr = (Node *) makeA_Expr(AEXPR_OR, NIL, expr,
(Node *) makeA_Expr(AEXPR_OP, opr,
larg, rarg));
}
else
......@@ -7585,10 +7573,10 @@ makeDistinctExpr(List *largs, List *rargs)
rarg = lfirst(rargs);
if (expr == NULL)
expr = (Node *) makeSimpleA_Expr(DISTINCT, "=", larg, rarg);
expr = (Node *) makeSimpleA_Expr(AEXPR_DISTINCT, "=", larg, rarg);
else
expr = (Node *) makeA_Expr(OR, NIL, expr,
(Node *) makeSimpleA_Expr(DISTINCT, "=",
expr = (Node *) makeA_Expr(AEXPR_OR, NIL, expr,
(Node *) makeSimpleA_Expr(AEXPR_DISTINCT, "=",
larg, rarg));
return expr;
......@@ -7613,9 +7601,9 @@ makeRowNullTest(NullTestType test, List *args)
if (expr == NULL)
expr = (Node *) n;
else if (test == IS_NOT_NULL)
expr = (Node *) makeA_Expr(OR, NIL, expr, (Node *)n);
expr = (Node *) makeA_Expr(AEXPR_OR, NIL, expr, (Node *)n);
else
expr = (Node *) makeA_Expr(AND, NIL, expr, (Node *)n);
expr = (Node *) makeA_Expr(AEXPR_AND, NIL, expr, (Node *)n);
return expr;
}
......@@ -7790,7 +7778,7 @@ doNegate(Node *n)
}
}
return (Node *) makeSimpleA_Expr(OP, "-", NULL, n);
return (Node *) makeSimpleA_Expr(AEXPR_OP, "-", NULL, n);
}
static void
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.133 2003/02/03 14:04:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.134 2003/02/10 04:44:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -30,7 +30,7 @@
*/
static const ScanKeyword ScanKeywords[] = {
/* name, value */
{"abort", ABORT_TRANS},
{"abort", ABORT_P},
{"absolute", ABSOLUTE},
{"access", ACCESS},
{"action", ACTION},
......@@ -51,7 +51,7 @@ static const ScanKeyword ScanKeywords[] = {
{"authorization", AUTHORIZATION},
{"backward", BACKWARD},
{"before", BEFORE},
{"begin", BEGIN_TRANS},
{"begin", BEGIN_P},
{"between", BETWEEN},
{"bigint", BIGINT},
{"binary", BINARY},
......@@ -117,7 +117,7 @@ static const ScanKeyword ScanKeywords[] = {
{"else", ELSE},
{"encoding", ENCODING},
{"encrypted", ENCRYPTED},
{"end", END_TRANS},
{"end", END_P},
{"escape", ESCAPE},
{"except", EXCEPT},
{"exclusive", EXCLUSIVE},
......@@ -137,7 +137,6 @@ static const ScanKeyword ScanKeywords[] = {
{"from", FROM},
{"full", FULL},
{"function", FUNCTION},
{"get", GET},
{"global", GLOBAL},
{"grant", GRANT},
{"group", GROUP_P},
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.105 2003/02/09 06:56:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.106 2003/02/10 04:44:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -22,7 +22,6 @@
#include "optimizer/tlist.h"
#include "optimizer/var.h"
#include "parser/analyze.h"
#include "parser/parse.h"
#include "parser/parsetree.h"
#include "parser/parse_clause.h"
#include "parser/parse_coerce.h"
......@@ -263,7 +262,7 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars)
Node *rvar = (Node *) lfirst(rvars);
A_Expr *e;
e = makeSimpleA_Expr(OP, "=", copyObject(lvar), copyObject(rvar));
e = makeSimpleA_Expr(AEXPR_OP, "=", copyObject(lvar), copyObject(rvar));
if (result == NULL)
result = (Node *) e;
......@@ -271,7 +270,7 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars)
{
A_Expr *a;
a = makeA_Expr(AND, NIL, result, (Node *) e);
a = makeA_Expr(AEXPR_AND, NIL, result, (Node *) e);
result = (Node *) a;
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.143 2003/02/09 06:56:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.144 2003/02/10 04:44:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -23,7 +23,6 @@
#include "nodes/plannodes.h"
#include "parser/analyze.h"
#include "parser/gramparse.h"
#include "parser/parse.h"
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "parser/parse_func.h"
......@@ -178,9 +177,9 @@ transformExpr(ParseState *pstate, Node *expr)
{
A_Expr *a = (A_Expr *) expr;
switch (a->oper)
switch (a->kind)
{
case OP:
case AEXPR_OP:
{
/*
* Special-case "foo = NULL" and "NULL = foo"
......@@ -219,7 +218,7 @@ transformExpr(ParseState *pstate, Node *expr)
}
}
break;
case AND:
case AEXPR_AND:
{
Node *lexpr = transformExpr(pstate,
a->lexpr);
......@@ -234,7 +233,7 @@ transformExpr(ParseState *pstate, Node *expr)
rexpr));
}
break;
case OR:
case AEXPR_OR:
{
Node *lexpr = transformExpr(pstate,
a->lexpr);
......@@ -249,7 +248,7 @@ transformExpr(ParseState *pstate, Node *expr)
rexpr));
}
break;
case NOT:
case AEXPR_NOT:
{
Node *rexpr = transformExpr(pstate,
a->rexpr);
......@@ -260,7 +259,7 @@ transformExpr(ParseState *pstate, Node *expr)
makeList1(rexpr));
}
break;
case DISTINCT:
case AEXPR_DISTINCT:
{
Node *lexpr = transformExpr(pstate,
a->lexpr);
......@@ -278,18 +277,17 @@ transformExpr(ParseState *pstate, Node *expr)
NodeSetTag(result, T_DistinctExpr);
}
break;
case OF:
case AEXPR_OF:
{
/*
* Checking an expression for match to type.
* Will result in a boolean constant node.
*/
List *telem;
A_Const *n;
Oid ltype,
rtype;
bool matched = FALSE;
/*
* Checking an expression for match to type.
* Will result in a boolean constant node.
*/
Node *lexpr = transformExpr(pstate,
a->lexpr);
......@@ -530,7 +528,7 @@ transformExpr(ParseState *pstate, Node *expr)
if (c->arg != NULL)
{
/* shorthand form was specified, so expand... */
warg = (Node *) makeSimpleA_Expr(OP, "=",
warg = (Node *) makeSimpleA_Expr(AEXPR_OP, "=",
(Node *) c->arg,
warg);
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.314 2003/01/01 21:57:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.315 2003/02/10 04:44:46 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
......@@ -44,7 +44,6 @@
#include "optimizer/cost.h"
#include "optimizer/planner.h"
#include "parser/analyze.h"
#include "parser/parse.h"
#include "parser/parser.h"
#include "rewrite/rewriteHandler.h"
#include "storage/ipc.h"
......@@ -666,7 +665,8 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
{
TransactionStmt *stmt = (TransactionStmt *) parsetree;
if (stmt->command == COMMIT || stmt->command == ROLLBACK)
if (stmt->kind == TRANS_STMT_COMMIT ||
stmt->kind == TRANS_STMT_ROLLBACK)
allowit = true;
}
......@@ -1781,7 +1781,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.314 $ $Date: 2003/01/01 21:57:05 $\n");
puts("$Revision: 1.315 $ $Date: 2003/02/10 04:44:46 $\n");
}
/*
......@@ -2212,21 +2212,21 @@ CreateCommandTag(Node *parsetree)
{
TransactionStmt *stmt = (TransactionStmt *) parsetree;
switch (stmt->command)
switch (stmt->kind)
{
case BEGIN_TRANS:
case TRANS_STMT_BEGIN:
tag = "BEGIN";
break;
case START:
case TRANS_STMT_START:
tag = "START TRANSACTION";
break;
case COMMIT:
case TRANS_STMT_COMMIT:
tag = "COMMIT";
break;
case ROLLBACK:
case TRANS_STMT_ROLLBACK:
tag = "ROLLBACK";
break;
......@@ -2329,15 +2329,15 @@ CreateCommandTag(Node *parsetree)
break;
case T_DefineStmt:
switch (((DefineStmt *) parsetree)->defType)
switch (((DefineStmt *) parsetree)->kind)
{
case AGGREGATE:
case DEFINE_STMT_AGGREGATE:
tag = "CREATE AGGREGATE";
break;
case OPERATOR:
case DEFINE_STMT_OPERATOR:
tag = "CREATE OPERATOR";
break;
case TYPE_P:
case DEFINE_STMT_TYPE:
tag = "CREATE TYPE";
break;
default:
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.190 2003/01/27 00:48:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.191 2003/02/10 04:44:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -42,7 +42,6 @@
#include "commands/view.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "parser/parse.h"
#include "parser/parse_clause.h"
#include "parser/parse_expr.h"
#include "parser/parse_type.h"
......@@ -261,9 +260,9 @@ ProcessUtility(Node *parsetree,
{
TransactionStmt *stmt = (TransactionStmt *) parsetree;
switch (stmt->command)
switch (stmt->kind)
{
case BEGIN_TRANS:
case TRANS_STMT_BEGIN:
BeginTransactionBlock();
break;
......@@ -272,7 +271,7 @@ ProcessUtility(Node *parsetree,
* Identical to BEGIN, except that it takes a few
* additional options.
*/
case START:
case TRANS_STMT_START:
{
BeginTransactionBlock();
......@@ -295,11 +294,11 @@ ProcessUtility(Node *parsetree,
}
break;
case COMMIT:
case TRANS_STMT_COMMIT:
EndTransactionBlock();
break;
case ROLLBACK:
case TRANS_STMT_ROLLBACK:
UserAbortTransactionBlock();
break;
}
......@@ -320,17 +319,10 @@ ProcessUtility(Node *parsetree,
case T_FetchStmt:
{
FetchStmt *stmt = (FetchStmt *) parsetree;
char *portalName = stmt->portalname;
bool forward;
long count;
forward = (bool) (stmt->direction == FORWARD);
/*
* parser ensures that count is >= 0
*/
count = stmt->howMany;
PerformPortalFetch(portalName, forward, count,
PerformPortalFetch(stmt->portalname,
stmt->direction == FETCH_FORWARD,
stmt->howMany,
(stmt->ismove) ? None : dest,
completionTag);
}
......@@ -693,17 +685,17 @@ ProcessUtility(Node *parsetree,
{
DefineStmt *stmt = (DefineStmt *) parsetree;
switch (stmt->defType)
switch (stmt->kind)
{
case OPERATOR:
case DEFINE_STMT_AGGREGATE:
DefineAggregate(stmt->defnames, stmt->definition);
break;
case DEFINE_STMT_OPERATOR:
DefineOperator(stmt->defnames, stmt->definition);
break;
case TYPE_P:
case DEFINE_STMT_TYPE:
DefineType(stmt->defnames, stmt->definition);
break;
case AGGREGATE:
DefineAggregate(stmt->defnames, stmt->definition);
break;
}
}
break;
......@@ -981,17 +973,17 @@ ProcessUtility(Node *parsetree,
{
ReindexStmt *stmt = (ReindexStmt *) parsetree;
switch (stmt->reindexType)
switch (stmt->kind)
{
case INDEX:
case REINDEX_INDEX:
CheckOwnership(stmt->relation, false);
ReindexIndex(stmt->relation, stmt->force);
break;
case TABLE:
case REINDEX_TABLE:
CheckOwnership(stmt->relation, false);
ReindexTable(stmt->relation, stmt->force);
break;
case DATABASE:
case REINDEX_DATABASE:
ReindexDatabase(stmt->name, stmt->force, false);
break;
}
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: makefuncs.h,v 1.43 2002/12/12 15:49:40 tgl Exp $
* $Id: makefuncs.h,v 1.44 2003/02/10 04:44:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -17,9 +17,10 @@
#include "nodes/parsenodes.h"
extern A_Expr *makeA_Expr(int oper, List *name, Node *lexpr, Node *rexpr);
extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name,
Node *lexpr, Node *rexpr);
extern A_Expr *makeSimpleA_Expr(int oper, const char *name,
extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, const char *name,
Node *lexpr, Node *rexpr);
extern Var *makeVar(Index varno,
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: parsenodes.h,v 1.228 2003/02/09 06:56:28 tgl Exp $
* $Id: parsenodes.h,v 1.229 2003/02/10 04:44:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -165,15 +165,25 @@ typedef struct ParamRef
} ParamRef;
/*
* A_Expr - binary expressions
* A_Expr - infix, prefix, and postfix expressions
*/
typedef enum A_Expr_Kind
{
AEXPR_OP, /* normal operator */
AEXPR_AND, /* booleans - name field is unused */
AEXPR_OR,
AEXPR_NOT,
AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */
AEXPR_OF /* IS (not) OF - name must be "=" or "!=" */
} A_Expr_Kind;
typedef struct A_Expr
{
NodeTag type;
int oper; /* type of operation (OP,OR,AND,NOT) */
A_Expr_Kind kind; /* see above */
List *name; /* possibly-qualified name of operator */
Node *lexpr; /* left argument */
Node *rexpr; /* right argument */
Node *lexpr; /* left argument, or NULL if none */
Node *rexpr; /* right argument, or NULL if none */
} A_Expr;
/*
......@@ -1058,13 +1068,20 @@ typedef struct CreateSeqStmt
} CreateSeqStmt;
/* ----------------------
* Create {Operator|Type|Aggregate} Statement
* Create {Aggregate|Operator|Type} Statement
* ----------------------
*/
typedef enum DefineStmtKind
{
DEFINE_STMT_AGGREGATE,
DEFINE_STMT_OPERATOR,
DEFINE_STMT_TYPE
} DefineStmtKind;
typedef struct DefineStmt
{
NodeTag type;
int defType; /* OPERATOR|TYPE_P|AGGREGATE */
DefineStmtKind kind; /* see above */
List *defnames; /* qualified name (list of Value strings) */
List *definition; /* a list of DefElem */
} DefineStmt;
......@@ -1196,11 +1213,18 @@ typedef struct CommentStmt
* Fetch Statement
* ----------------------
*/
typedef enum FetchDirection
{
FETCH_FORWARD,
FETCH_BACKWARD
/* ABSOLUTE someday? */
} FetchDirection;
typedef struct FetchStmt
{
NodeTag type;
int direction; /* FORWARD or BACKWARD */
long howMany; /* amount to fetch */
FetchDirection direction; /* see above */
long howMany; /* number of rows */
char *portalname; /* name of portal (cursor) */
bool ismove; /* TRUE if MOVE */
} FetchStmt;
......@@ -1357,11 +1381,19 @@ typedef struct UnlistenStmt
* {Begin|Commit|Rollback} Transaction Statement
* ----------------------
*/
typedef enum TransactionStmtKind
{
TRANS_STMT_BEGIN,
TRANS_STMT_START, /* semantically identical to BEGIN */
TRANS_STMT_COMMIT,
TRANS_STMT_ROLLBACK
} TransactionStmtKind;
typedef struct TransactionStmt
{
NodeTag type;
int command; /* BEGIN_TRANS|START|COMMIT|ROLLBACK */
List *options;
TransactionStmtKind kind; /* see above */
List *options; /* for BEGIN/START only */
} TransactionStmt;
/* ----------------------
......@@ -1544,10 +1576,17 @@ typedef struct ConstraintsSetStmt
* REINDEX Statement
* ----------------------
*/
typedef enum ReindexStmtKind
{
REINDEX_INDEX,
REINDEX_TABLE,
REINDEX_DATABASE
} ReindexStmtKind;
typedef struct ReindexStmt
{
NodeTag type;
int reindexType; /* INDEX|TABLE|DATABASE */
ReindexStmtKind kind; /* see above */
RangeVar *relation; /* Table or index to reindex */
const char *name; /* name of database to reindex */
bool force;
......
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