1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-17 06:41:09 +03:00

Subselects with =, >, etc.

Cleanup for vacuum help, manual page, and error message
This commit is contained in:
Bruce Momjian
1998-02-03 19:27:30 +00:00
parent f00a9e3e9f
commit 00f325d510
5 changed files with 462 additions and 10 deletions

View File

@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.102 1998/02/03 16:04:02 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.103 1998/02/03 19:26:41 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -2916,6 +2916,76 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '+' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("+",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '-' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("-",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '/' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("/",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '*' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("*",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '<' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("<",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '>' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons(">",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '=' ANY '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("=",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' Op ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
@ -2926,6 +2996,76 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '+' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("+",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '-' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("-",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '/' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("/",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '*' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("*",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '<' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("<",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '>' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons(">",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '=' ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("=",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $7;
$$ = (Node *)n;
}
| '(' row_descriptor ')' Op '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
@ -2939,10 +3079,108 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')'
n->subselect = $6;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '+' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("+", NIL);
n->useor = false;
n->subLinkType = EXPR_SUBLINK;
n->subselect = $6;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '-' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("-", NIL);
n->useor = false;
n->subLinkType = EXPR_SUBLINK;
n->subselect = $6;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '/' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("/", NIL);
n->useor = false;
n->subLinkType = EXPR_SUBLINK;
n->subselect = $6;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '*' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("*", NIL);
n->useor = false;
n->subLinkType = EXPR_SUBLINK;
n->subselect = $6;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '<' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("<", NIL);
n->useor = false;
n->subLinkType = EXPR_SUBLINK;
n->subselect = $6;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '>' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons(">", NIL);
n->useor = false;
n->subLinkType = EXPR_SUBLINK;
n->subselect = $6;
$$ = (Node *)n;
}
| '(' row_descriptor ')' '=' '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
n->lefthand = $2;
n->oper = lcons("=", NIL);
n->useor = false;
n->subLinkType = EXPR_SUBLINK;
n->subselect = $6;
$$ = (Node *)n;
}
| '(' row_descriptor ')' Op '(' row_descriptor ')'
{
$$ = makeRowExpr($4, $2, $6);
}
| '(' row_descriptor ')' '+' '(' row_descriptor ')'
{
$$ = makeRowExpr("+", $2, $6);
}
| '(' row_descriptor ')' '-' '(' row_descriptor ')'
{
$$ = makeRowExpr("-", $2, $6);
}
| '(' row_descriptor ')' '/' '(' row_descriptor ')'
{
$$ = makeRowExpr("/", $2, $6);
}
| '(' row_descriptor ')' '*' '(' row_descriptor ')'
{
$$ = makeRowExpr("*", $2, $6);
}
| '(' row_descriptor ')' '<' '(' row_descriptor ')'
{
$$ = makeRowExpr("<", $2, $6);
}
| '(' row_descriptor ')' '>' '(' row_descriptor ')'
{
$$ = makeRowExpr(">", $2, $6);
}
| '(' row_descriptor ')' '=' '(' row_descriptor ')'
{
$$ = makeRowExpr("=", $2, $6);
}
;
row_descriptor: row_list ',' a_expr
@ -3320,6 +3558,76 @@ a_expr: attr opt_indirection
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->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->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->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->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->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->lefthand = lcons($1,NIL);
n->oper = lcons("=",NIL);
n->useor = false;
n->subLinkType = ANY_SUBLINK;
n->subselect = $5;
$$ = (Node *)n;
}
| a_expr Op ALL '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
@ -3330,6 +3638,76 @@ a_expr: attr opt_indirection
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->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->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->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->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->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->lefthand = lcons($1, NULL);
n->oper = lcons("=",NIL);
n->useor = false;
n->subLinkType = ALL_SUBLINK;
n->subselect = $5;
$$ = (Node *)n;
}
| a_expr Op '(' SubSelect ')'
{
SubLink *n = makeNode(SubLink);
@ -3340,6 +3718,76 @@ a_expr: attr opt_indirection
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 = ALL_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 = ALL_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 = ALL_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 = ALL_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 = ALL_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 = ALL_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 = ALL_SUBLINK;
n->subselect = $4;
$$ = (Node *)n;
}
| a_expr AND a_expr
{ $$ = makeA_Expr(AND, NULL, $1, $3); }
| a_expr OR a_expr