*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.88.2.2 1999/09/14 06:07:35 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.88.2.3 1999/09/24 15:08:59 thomas Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
having_clause
%type <list> row_descriptor, row_list, c_list, c_expr
%type <node> row_expr
-%type <str> row_op
%type <node> case_expr, case_arg, when_clause, case_default
%type <list> when_clause_list
%type <ival> sub_type
{ $$ = nconc( $1, lcons( makeString( "-"), $3)); }
| default_expr '/' default_expr
{ $$ = nconc( $1, lcons( makeString( "/"), $3)); }
- | default_expr '%' default_expr
- { $$ = nconc( $1, lcons( makeString( "%"), $3)); }
| default_expr '*' default_expr
{ $$ = nconc( $1, lcons( makeString( "*"), $3)); }
+ | default_expr '%' default_expr
+ { $$ = nconc( $1, lcons( makeString( "%"), $3)); }
| default_expr '^' default_expr
{ $$ = nconc( $1, lcons( makeString( "^"), $3)); }
+ | default_expr '|' default_expr
+ { $$ = nconc( $1, lcons( makeString( "|"), $3)); }
| default_expr '=' default_expr
{ elog(ERROR,"boolean expressions not supported in DEFAULT"); }
| default_expr '<' default_expr
{ $$ = nconc( $1, lcons( makeString( "-"), $3)); }
| constraint_expr '/' constraint_expr
{ $$ = nconc( $1, lcons( makeString( "/"), $3)); }
- | constraint_expr '%' constraint_expr
- { $$ = nconc( $1, lcons( makeString( "%"), $3)); }
| constraint_expr '*' constraint_expr
{ $$ = nconc( $1, lcons( makeString( "*"), $3)); }
+ | constraint_expr '%' constraint_expr
+ { $$ = nconc( $1, lcons( makeString( "%"), $3)); }
| constraint_expr '^' constraint_expr
{ $$ = nconc( $1, lcons( makeString( "^"), $3)); }
+ | constraint_expr '|' constraint_expr
+ { $$ = nconc( $1, lcons( makeString( "|"), $3)); }
| constraint_expr '=' constraint_expr
{ $$ = nconc( $1, lcons( makeString( "="), $3)); }
| constraint_expr '<' constraint_expr
all_Op: Op | MathOp;
-MathOp: '+' { $$ = "+"; }
+MathOp: '+' { $$ = "+"; }
| '-' { $$ = "-"; }
| '*' { $$ = "*"; }
| '/' { $$ = "/"; }
- | '%' { $$ = "%"; }
| '<' { $$ = "<"; }
| '>' { $$ = ">"; }
+ | '%' { $$ = "%"; }
+ | '^' { $$ = "^"; }
+ | '|' { $$ = "|"; }
| '=' { $$ = "="; }
;
/* Expressions using row descriptors
* Define row_descriptor to allow yacc to break the reduce/reduce conflict
* with singleton expressions.
- * Eliminated lots of code by defining row_op and sub_type clauses.
+ * Eliminated lots of code by defining sub_type clauses.
* However, can not consolidate EXPR_LINK case with others subselects
* due to shift/reduce conflict with the non-subselect clause (the parser
* would have to look ahead more than one token to resolve the conflict).
n->subselect = $7;
$$ = (Node *)n;
}
- | '(' row_descriptor ')' row_op sub_type '(' SubSelect ')'
+ | '(' row_descriptor ')' all_Op sub_type '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->subselect = $7;
$$ = (Node *)n;
}
- | '(' row_descriptor ')' row_op '(' SubSelect ')'
+ | '(' row_descriptor ')' all_Op '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->subselect = $6;
$$ = (Node *)n;
}
- | '(' row_descriptor ')' row_op '(' row_descriptor ')'
+ | '(' row_descriptor ')' all_Op '(' row_descriptor ')'
{
$$ = makeRowExpr($4, $2, $6);
}
}
;
-row_op: Op { $$ = $1; }
- | '<' { $$ = "<"; }
- | '=' { $$ = "="; }
- | '>' { $$ = ">"; }
- | '+' { $$ = "+"; }
- | '-' { $$ = "-"; }
- | '*' { $$ = "*"; }
- | '/' { $$ = "/"; }
- | '%' { $$ = "%"; }
- ;
-
sub_type: ANY { $$ = ANY_SUBLINK; }
| ALL { $$ = ALL_SUBLINK; }
;
{ $$ = makeA_Expr(OP, "-", $1, $3); }
| a_expr '/' a_expr
{ $$ = makeA_Expr(OP, "/", $1, $3); }
- | a_expr '%' a_expr
- { $$ = makeA_Expr(OP, "%", $1, $3); }
| a_expr '*' a_expr
{ $$ = makeA_Expr(OP, "*", $1, $3); }
+ | a_expr '%' a_expr
+ { $$ = makeA_Expr(OP, "%", $1, $3); }
| a_expr '^' a_expr
{ $$ = makeA_Expr(OP, "^", $1, $3); }
+ | a_expr '|' a_expr
+ { $$ = makeA_Expr(OP, "|", $1, $3); }
| a_expr '<' a_expr
{ $$ = makeA_Expr(OP, "<", $1, $3); }
| a_expr '>' a_expr
n->subselect = $4;
$$ = (Node *)n;
}
+ | a_expr '*' '(' SubSelect ')'
+ {
+ SubLink *n = makeNode(SubLink);
+ n->lefthand = lcons($1, NULL);
+ n->oper = lcons("*",NIL);
+ n->useor = false;
+ n->subLinkType = EXPR_SUBLINK;
+ n->subselect = $4;
+ $$ = (Node *)n;
+ }
| a_expr '%' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->subselect = $4;
$$ = (Node *)n;
}
- | a_expr '*' '(' SubSelect ')'
+ | a_expr '^' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = lcons($1, NULL);
- n->oper = lcons("*",NIL);
+ n->oper = lcons("^",NIL);
+ n->useor = false;
+ n->subLinkType = EXPR_SUBLINK;
+ n->subselect = $4;
+ $$ = (Node *)n;
+ }
+ | a_expr '|' '(' SubSelect ')'
+ {
+ SubLink *n = makeNode(SubLink);
+ n->lefthand = lcons($1, NULL);
+ n->oper = lcons("|",NIL);
n->useor = false;
n->subLinkType = EXPR_SUBLINK;
n->subselect = $4;
n->subselect = $5;
$$ = (Node *)n;
}
+ | a_expr '*' ANY '(' SubSelect ')'
+ {
+ SubLink *n = makeNode(SubLink);
+ n->lefthand = lcons($1,NIL);
+ n->oper = lcons("*",NIL);
+ n->useor = false;
+ n->subLinkType = ANY_SUBLINK;
+ n->subselect = $5;
+ $$ = (Node *)n;
+ }
| a_expr '%' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->subselect = $5;
$$ = (Node *)n;
}
- | a_expr '*' ANY '(' SubSelect ')'
+ | a_expr '^' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = lcons($1,NIL);
- n->oper = lcons("*",NIL);
+ n->oper = lcons("^",NIL);
+ n->useor = false;
+ n->subLinkType = ANY_SUBLINK;
+ n->subselect = $5;
+ $$ = (Node *)n;
+ }
+ | a_expr '|' ANY '(' SubSelect ')'
+ {
+ SubLink *n = makeNode(SubLink);
+ n->lefthand = lcons($1,NIL);
+ n->oper = lcons("|",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $5;
n->subselect = $5;
$$ = (Node *)n;
}
+ | a_expr '*' ALL '(' SubSelect ')'
+ {
+ SubLink *n = makeNode(SubLink);
+ n->lefthand = lcons($1, NULL);
+ n->oper = lcons("*",NIL);
+ n->useor = false;
+ n->subLinkType = ALL_SUBLINK;
+ n->subselect = $5;
+ $$ = (Node *)n;
+ }
| a_expr '%' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->subselect = $5;
$$ = (Node *)n;
}
- | a_expr '*' ALL '(' SubSelect ')'
+ | a_expr '^' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = lcons($1, NULL);
- n->oper = lcons("*",NIL);
+ n->oper = lcons("^",NIL);
+ n->useor = false;
+ n->subLinkType = ALL_SUBLINK;
+ n->subselect = $5;
+ $$ = (Node *)n;
+ }
+ | a_expr '|' ALL '(' SubSelect ')'
+ {
+ SubLink *n = makeNode(SubLink);
+ n->lefthand = lcons($1, NULL);
+ n->oper = lcons("|",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $5;
{ $$ = makeA_Expr(OP, "-", $1, $3); }
| b_expr '/' b_expr
{ $$ = makeA_Expr(OP, "/", $1, $3); }
+ | b_expr '*' b_expr
+ { $$ = makeA_Expr(OP, "*", $1, $3); }
| b_expr '%' b_expr
{ $$ = makeA_Expr(OP, "%", $1, $3); }
| b_expr '^' b_expr
{ $$ = makeA_Expr(OP, "^", $1, $3); }
- | b_expr '*' b_expr
- { $$ = makeA_Expr(OP, "*", $1, $3); }
+ | b_expr '|' b_expr
+ { $$ = makeA_Expr(OP, "|", $1, $3); }
| ':' b_expr
{ $$ = makeA_Expr(OP, ":", NULL, $2); }
| ';' b_expr
{ $$ = makeA_Expr(OP, "-", $1, $3); }
| position_expr '/' position_expr
{ $$ = makeA_Expr(OP, "/", $1, $3); }
- | position_expr '%' position_expr
- { $$ = makeA_Expr(OP, "%", $1, $3); }
| position_expr '*' position_expr
{ $$ = makeA_Expr(OP, "*", $1, $3); }
+ | position_expr '%' position_expr
+ { $$ = makeA_Expr(OP, "%", $1, $3); }
+ | position_expr '^' position_expr
+ { $$ = makeA_Expr(OP, "^", $1, $3); }
+ | position_expr '|' position_expr
+ { $$ = makeA_Expr(OP, "|", $1, $3); }
| '|' position_expr
{ $$ = makeA_Expr(OP, "|", NULL, $2); }
| position_expr TYPECAST Typename