10
10
*
11
11
*
12
12
* IDENTIFICATION
13
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.88.2.2 1999/09/14 06:07:35 thomas Exp $
13
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.88.2.3 1999/09/24 15:08:59 thomas Exp $
14
14
*
15
15
* HISTORY
16
16
* AUTHOR DATE MAJOR EVENT
@@ -221,7 +221,6 @@ Oid param_type(int t); /* used in parse_expr.c */
221
221
having_clause
222
222
%type <list> row_descriptor, row_list, c_list, c_expr
223
223
%type <node> row_expr
224
- %type <str> row_op
225
224
%type <node> case_expr, case_arg, when_clause, case_default
226
225
%type <list> when_clause_list
227
226
%type <ival> sub_type
@@ -970,12 +969,14 @@ default_expr: AexprConst
970
969
{ $$ = nconc( $1, lcons( makeString( "-"), $3)); }
971
970
| default_expr '/' default_expr
972
971
{ $$ = nconc( $1, lcons( makeString( "/"), $3)); }
973
- | default_expr '%' default_expr
974
- { $$ = nconc( $1, lcons( makeString( "%"), $3)); }
975
972
| default_expr '*' default_expr
976
973
{ $$ = nconc( $1, lcons( makeString( "*"), $3)); }
974
+ | default_expr '%' default_expr
975
+ { $$ = nconc( $1, lcons( makeString( "%"), $3)); }
977
976
| default_expr '^' default_expr
978
977
{ $$ = nconc( $1, lcons( makeString( "^"), $3)); }
978
+ | default_expr '|' default_expr
979
+ { $$ = nconc( $1, lcons( makeString( "|"), $3)); }
979
980
| default_expr '=' default_expr
980
981
{ elog(ERROR,"boolean expressions not supported in DEFAULT"); }
981
982
| default_expr '<' default_expr
@@ -1120,12 +1121,14 @@ constraint_expr: AexprConst
1120
1121
{ $$ = nconc( $1, lcons( makeString( "-"), $3)); }
1121
1122
| constraint_expr '/' constraint_expr
1122
1123
{ $$ = nconc( $1, lcons( makeString( "/"), $3)); }
1123
- | constraint_expr '%' constraint_expr
1124
- { $$ = nconc( $1, lcons( makeString( "%"), $3)); }
1125
1124
| constraint_expr '*' constraint_expr
1126
1125
{ $$ = nconc( $1, lcons( makeString( "*"), $3)); }
1126
+ | constraint_expr '%' constraint_expr
1127
+ { $$ = nconc( $1, lcons( makeString( "%"), $3)); }
1127
1128
| constraint_expr '^' constraint_expr
1128
1129
{ $$ = nconc( $1, lcons( makeString( "^"), $3)); }
1130
+ | constraint_expr '|' constraint_expr
1131
+ { $$ = nconc( $1, lcons( makeString( "|"), $3)); }
1129
1132
| constraint_expr '=' constraint_expr
1130
1133
{ $$ = nconc( $1, lcons( makeString( "="), $3)); }
1131
1134
| constraint_expr '<' constraint_expr
@@ -2016,13 +2019,15 @@ RemoveOperStmt: DROP OPERATOR all_Op '(' oper_argtypes ')'
2016
2019
2017
2020
all_Op: Op | MathOp;
2018
2021
2019
- MathOp: '+' { $$ = "+"; }
2022
+ MathOp: '+' { $$ = "+"; }
2020
2023
| '-' { $$ = "-"; }
2021
2024
| '*' { $$ = "*"; }
2022
2025
| '/' { $$ = "/"; }
2023
- | '%' { $$ = "%"; }
2024
2026
| '<' { $$ = "<"; }
2025
2027
| '>' { $$ = ">"; }
2028
+ | '%' { $$ = "%"; }
2029
+ | '^' { $$ = "^"; }
2030
+ | '|' { $$ = "|"; }
2026
2031
| '=' { $$ = "="; }
2027
2032
;
2028
2033
@@ -3528,7 +3533,7 @@ a_expr_or_null: a_expr
3528
3533
/* Expressions using row descriptors
3529
3534
* Define row_descriptor to allow yacc to break the reduce/reduce conflict
3530
3535
* with singleton expressions.
3531
- * Eliminated lots of code by defining row_op and sub_type clauses.
3536
+ * Eliminated lots of code by defining sub_type clauses.
3532
3537
* However, can not consolidate EXPR_LINK case with others subselects
3533
3538
* due to shift/reduce conflict with the non-subselect clause (the parser
3534
3539
* would have to look ahead more than one token to resolve the conflict).
@@ -3554,7 +3559,7 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
3554
3559
n->subselect = $7;
3555
3560
$$ = (Node *)n;
3556
3561
}
3557
- | '(' row_descriptor ')' row_op sub_type '(' SubSelect ')'
3562
+ | '(' row_descriptor ')' all_Op sub_type '(' SubSelect ')'
3558
3563
{
3559
3564
SubLink *n = makeNode(SubLink);
3560
3565
n->lefthand = $2;
@@ -3567,7 +3572,7 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
3567
3572
n->subselect = $7;
3568
3573
$$ = (Node *)n;
3569
3574
}
3570
- | '(' row_descriptor ')' row_op '(' SubSelect ')'
3575
+ | '(' row_descriptor ')' all_Op '(' SubSelect ')'
3571
3576
{
3572
3577
SubLink *n = makeNode(SubLink);
3573
3578
n->lefthand = $2;
@@ -3580,7 +3585,7 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
3580
3585
n->subselect = $6;
3581
3586
$$ = (Node *)n;
3582
3587
}
3583
- | '(' row_descriptor ')' row_op '(' row_descriptor ')'
3588
+ | '(' row_descriptor ')' all_Op '(' row_descriptor ')'
3584
3589
{
3585
3590
$$ = makeRowExpr($4, $2, $6);
3586
3591
}
@@ -3602,17 +3607,6 @@ row_list: row_list ',' a_expr
3602
3607
}
3603
3608
;
3604
3609
3605
- row_op: Op { $$ = $1; }
3606
- | '<' { $$ = "<"; }
3607
- | '=' { $$ = "="; }
3608
- | '>' { $$ = ">"; }
3609
- | '+' { $$ = "+"; }
3610
- | '-' { $$ = "-"; }
3611
- | '*' { $$ = "*"; }
3612
- | '/' { $$ = "/"; }
3613
- | '%' { $$ = "%"; }
3614
- ;
3615
-
3616
3610
sub_type: ANY { $$ = ANY_SUBLINK; }
3617
3611
| ALL { $$ = ALL_SUBLINK; }
3618
3612
;
@@ -3658,12 +3652,14 @@ a_expr: attr opt_indirection
3658
3652
{ $$ = makeA_Expr(OP, "-", $1, $3); }
3659
3653
| a_expr '/' a_expr
3660
3654
{ $$ = makeA_Expr(OP, "/", $1, $3); }
3661
- | a_expr '%' a_expr
3662
- { $$ = makeA_Expr(OP, "%", $1, $3); }
3663
3655
| a_expr '*' a_expr
3664
3656
{ $$ = makeA_Expr(OP, "*", $1, $3); }
3657
+ | a_expr '%' a_expr
3658
+ { $$ = makeA_Expr(OP, "%", $1, $3); }
3665
3659
| a_expr '^' a_expr
3666
3660
{ $$ = makeA_Expr(OP, "^", $1, $3); }
3661
+ | a_expr '|' a_expr
3662
+ { $$ = makeA_Expr(OP, "|", $1, $3); }
3667
3663
| a_expr '<' a_expr
3668
3664
{ $$ = makeA_Expr(OP, "<", $1, $3); }
3669
3665
| a_expr '>' a_expr
@@ -4049,6 +4045,16 @@ a_expr: attr opt_indirection
4049
4045
n->subselect = $4;
4050
4046
$$ = (Node *)n;
4051
4047
}
4048
+ | a_expr '*' '(' SubSelect ')'
4049
+ {
4050
+ SubLink *n = makeNode(SubLink);
4051
+ n->lefthand = lcons($1, NULL);
4052
+ n->oper = lcons("*",NIL);
4053
+ n->useor = false;
4054
+ n->subLinkType = EXPR_SUBLINK;
4055
+ n->subselect = $4;
4056
+ $$ = (Node *)n;
4057
+ }
4052
4058
| a_expr '%' '(' SubSelect ')'
4053
4059
{
4054
4060
SubLink *n = makeNode(SubLink);
@@ -4059,11 +4065,21 @@ a_expr: attr opt_indirection
4059
4065
n->subselect = $4;
4060
4066
$$ = (Node *)n;
4061
4067
}
4062
- | a_expr '* ' '(' SubSelect ')'
4068
+ | a_expr '^ ' '(' SubSelect ')'
4063
4069
{
4064
4070
SubLink *n = makeNode(SubLink);
4065
4071
n->lefthand = lcons($1, NULL);
4066
- n->oper = lcons("*",NIL);
4072
+ n->oper = lcons("^",NIL);
4073
+ n->useor = false;
4074
+ n->subLinkType = EXPR_SUBLINK;
4075
+ n->subselect = $4;
4076
+ $$ = (Node *)n;
4077
+ }
4078
+ | a_expr '|' '(' SubSelect ')'
4079
+ {
4080
+ SubLink *n = makeNode(SubLink);
4081
+ n->lefthand = lcons($1, NULL);
4082
+ n->oper = lcons("|",NIL);
4067
4083
n->useor = false;
4068
4084
n->subLinkType = EXPR_SUBLINK;
4069
4085
n->subselect = $4;
@@ -4139,6 +4155,16 @@ a_expr: attr opt_indirection
4139
4155
n->subselect = $5;
4140
4156
$$ = (Node *)n;
4141
4157
}
4158
+ | a_expr '*' ANY '(' SubSelect ')'
4159
+ {
4160
+ SubLink *n = makeNode(SubLink);
4161
+ n->lefthand = lcons($1,NIL);
4162
+ n->oper = lcons("*",NIL);
4163
+ n->useor = false;
4164
+ n->subLinkType = ANY_SUBLINK;
4165
+ n->subselect = $5;
4166
+ $$ = (Node *)n;
4167
+ }
4142
4168
| a_expr '%' ANY '(' SubSelect ')'
4143
4169
{
4144
4170
SubLink *n = makeNode(SubLink);
@@ -4149,11 +4175,21 @@ a_expr: attr opt_indirection
4149
4175
n->subselect = $5;
4150
4176
$$ = (Node *)n;
4151
4177
}
4152
- | a_expr '* ' ANY '(' SubSelect ')'
4178
+ | a_expr '^ ' ANY '(' SubSelect ')'
4153
4179
{
4154
4180
SubLink *n = makeNode(SubLink);
4155
4181
n->lefthand = lcons($1,NIL);
4156
- n->oper = lcons("*",NIL);
4182
+ n->oper = lcons("^",NIL);
4183
+ n->useor = false;
4184
+ n->subLinkType = ANY_SUBLINK;
4185
+ n->subselect = $5;
4186
+ $$ = (Node *)n;
4187
+ }
4188
+ | a_expr '|' ANY '(' SubSelect ')'
4189
+ {
4190
+ SubLink *n = makeNode(SubLink);
4191
+ n->lefthand = lcons($1,NIL);
4192
+ n->oper = lcons("|",NIL);
4157
4193
n->useor = false;
4158
4194
n->subLinkType = ANY_SUBLINK;
4159
4195
n->subselect = $5;
@@ -4229,6 +4265,16 @@ a_expr: attr opt_indirection
4229
4265
n->subselect = $5;
4230
4266
$$ = (Node *)n;
4231
4267
}
4268
+ | a_expr '*' ALL '(' SubSelect ')'
4269
+ {
4270
+ SubLink *n = makeNode(SubLink);
4271
+ n->lefthand = lcons($1, NULL);
4272
+ n->oper = lcons("*",NIL);
4273
+ n->useor = false;
4274
+ n->subLinkType = ALL_SUBLINK;
4275
+ n->subselect = $5;
4276
+ $$ = (Node *)n;
4277
+ }
4232
4278
| a_expr '%' ALL '(' SubSelect ')'
4233
4279
{
4234
4280
SubLink *n = makeNode(SubLink);
@@ -4239,11 +4285,21 @@ a_expr: attr opt_indirection
4239
4285
n->subselect = $5;
4240
4286
$$ = (Node *)n;
4241
4287
}
4242
- | a_expr '* ' ALL '(' SubSelect ')'
4288
+ | a_expr '^ ' ALL '(' SubSelect ')'
4243
4289
{
4244
4290
SubLink *n = makeNode(SubLink);
4245
4291
n->lefthand = lcons($1, NULL);
4246
- n->oper = lcons("*",NIL);
4292
+ n->oper = lcons("^",NIL);
4293
+ n->useor = false;
4294
+ n->subLinkType = ALL_SUBLINK;
4295
+ n->subselect = $5;
4296
+ $$ = (Node *)n;
4297
+ }
4298
+ | a_expr '|' ALL '(' SubSelect ')'
4299
+ {
4300
+ SubLink *n = makeNode(SubLink);
4301
+ n->lefthand = lcons($1, NULL);
4302
+ n->oper = lcons("|",NIL);
4247
4303
n->useor = false;
4248
4304
n->subLinkType = ALL_SUBLINK;
4249
4305
n->subselect = $5;
@@ -4325,12 +4381,14 @@ b_expr: attr opt_indirection
4325
4381
{ $$ = makeA_Expr(OP, "-", $1, $3); }
4326
4382
| b_expr '/' b_expr
4327
4383
{ $$ = makeA_Expr(OP, "/", $1, $3); }
4384
+ | b_expr '*' b_expr
4385
+ { $$ = makeA_Expr(OP, "*", $1, $3); }
4328
4386
| b_expr '%' b_expr
4329
4387
{ $$ = makeA_Expr(OP, "%", $1, $3); }
4330
4388
| b_expr '^' b_expr
4331
4389
{ $$ = makeA_Expr(OP, "^", $1, $3); }
4332
- | b_expr '* ' b_expr
4333
- { $$ = makeA_Expr(OP, "* ", $1, $3); }
4390
+ | b_expr '| ' b_expr
4391
+ { $$ = makeA_Expr(OP, "| ", $1, $3); }
4334
4392
| ':' b_expr
4335
4393
{ $$ = makeA_Expr(OP, ":", NULL, $2); }
4336
4394
| ';' b_expr
@@ -4602,10 +4660,14 @@ position_expr: attr opt_indirection
4602
4660
{ $$ = makeA_Expr(OP, "-", $1, $3); }
4603
4661
| position_expr '/' position_expr
4604
4662
{ $$ = makeA_Expr(OP, "/", $1, $3); }
4605
- | position_expr '%' position_expr
4606
- { $$ = makeA_Expr(OP, "%", $1, $3); }
4607
4663
| position_expr '*' position_expr
4608
4664
{ $$ = makeA_Expr(OP, "*", $1, $3); }
4665
+ | position_expr '%' position_expr
4666
+ { $$ = makeA_Expr(OP, "%", $1, $3); }
4667
+ | position_expr '^' position_expr
4668
+ { $$ = makeA_Expr(OP, "^", $1, $3); }
4669
+ | position_expr '|' position_expr
4670
+ { $$ = makeA_Expr(OP, "|", $1, $3); }
4609
4671
| '|' position_expr
4610
4672
{ $$ = makeA_Expr(OP, "|", NULL, $2); }
4611
4673
| position_expr TYPECAST Typename
0 commit comments