|
11 | 11 | *
|
12 | 12 | *
|
13 | 13 | * IDENTIFICATION
|
14 |
| - * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.475 2004/08/29 04:12:35 momjian Exp $ |
| 14 | + * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.476 2004/09/29 23:39:20 tgl Exp $ |
15 | 15 | *
|
16 | 16 | * HISTORY
|
17 | 17 | * AUTHOR DATE MAJOR EVENT
|
@@ -272,8 +272,8 @@ static void doNegateFloat(Value *v);
|
272 | 272 | %type <node> columnDef
|
273 | 273 | %type <defelt> def_elem
|
274 | 274 | %type <node> def_arg columnElem where_clause
|
275 |
| - a_expr b_expr c_expr AexprConst indirection_el columnref |
276 |
| - in_expr having_clause func_table array_expr |
| 275 | + a_expr b_expr c_expr func_expr AexprConst indirection_el |
| 276 | + columnref in_expr having_clause func_table array_expr |
277 | 277 | %type <list> row type_list array_expr_list
|
278 | 278 | %type <node> case_expr case_arg when_clause case_default
|
279 | 279 | %type <list> when_clause_list
|
@@ -3238,18 +3238,12 @@ index_elem: ColId opt_class
|
3238 | 3238 | $$->expr = NULL;
|
3239 | 3239 | $$->opclass = $2;
|
3240 | 3240 | }
|
3241 |
| - | func_name '(' expr_list ')' opt_class |
| 3241 | + | func_expr opt_class |
3242 | 3242 | {
|
3243 |
| - FuncCall *n = makeNode(FuncCall); |
3244 |
| - n->funcname = $1; |
3245 |
| - n->args = $3; |
3246 |
| - n->agg_star = FALSE; |
3247 |
| - n->agg_distinct = FALSE; |
3248 |
| - |
3249 | 3243 | $$ = makeNode(IndexElem);
|
3250 | 3244 | $$->name = NULL;
|
3251 |
| - $$->expr = (Node *)n; |
3252 |
| - $$->opclass = $5; |
| 3245 | + $$->expr = $1; |
| 3246 | + $$->opclass = $2; |
3253 | 3247 | }
|
3254 | 3248 | | '(' a_expr ')' opt_class
|
3255 | 3249 | {
|
@@ -6479,7 +6473,55 @@ c_expr: columnref { $$ = $1; }
|
6479 | 6473 | }
|
6480 | 6474 | | case_expr
|
6481 | 6475 | { $$ = $1; }
|
6482 |
| - | func_name '(' ')' |
| 6476 | + | func_expr |
| 6477 | + { $$ = $1; } |
| 6478 | + | select_with_parens %prec UMINUS |
| 6479 | + { |
| 6480 | + SubLink *n = makeNode(SubLink); |
| 6481 | + n->subLinkType = EXPR_SUBLINK; |
| 6482 | + n->lefthand = NIL; |
| 6483 | + n->operName = NIL; |
| 6484 | + n->subselect = $1; |
| 6485 | + $$ = (Node *)n; |
| 6486 | + } |
| 6487 | + | EXISTS select_with_parens |
| 6488 | + { |
| 6489 | + SubLink *n = makeNode(SubLink); |
| 6490 | + n->subLinkType = EXISTS_SUBLINK; |
| 6491 | + n->lefthand = NIL; |
| 6492 | + n->operName = NIL; |
| 6493 | + n->subselect = $2; |
| 6494 | + $$ = (Node *)n; |
| 6495 | + } |
| 6496 | + | ARRAY select_with_parens |
| 6497 | + { |
| 6498 | + SubLink *n = makeNode(SubLink); |
| 6499 | + n->subLinkType = ARRAY_SUBLINK; |
| 6500 | + n->lefthand = NIL; |
| 6501 | + n->operName = NIL; |
| 6502 | + n->subselect = $2; |
| 6503 | + $$ = (Node *)n; |
| 6504 | + } |
| 6505 | + | ARRAY array_expr |
| 6506 | + { $$ = $2; } |
| 6507 | + | row |
| 6508 | + { |
| 6509 | + RowExpr *r = makeNode(RowExpr); |
| 6510 | + r->args = $1; |
| 6511 | + r->row_typeid = InvalidOid; /* not analyzed yet */ |
| 6512 | + $$ = (Node *)r; |
| 6513 | + } |
| 6514 | + ; |
| 6515 | + |
| 6516 | +/* |
| 6517 | + * func_expr is split out from c_expr just so that we have a classification |
| 6518 | + * for "everything that is a function call or looks like one". This isn't |
| 6519 | + * very important, but it saves us having to document which variants are |
| 6520 | + * legal in the backwards-compatible functional-index syntax for CREATE INDEX. |
| 6521 | + * (Note that many of the special SQL functions wouldn't actually make any |
| 6522 | + * sense as functional index entries, but we ignore that consideration here.) |
| 6523 | + */ |
| 6524 | +func_expr: func_name '(' ')' |
6483 | 6525 | {
|
6484 | 6526 | FuncCall *n = makeNode(FuncCall);
|
6485 | 6527 | n->funcname = $1;
|
@@ -6936,42 +6978,6 @@ c_expr: columnref { $$ = $1; }
|
6936 | 6978 | n->agg_distinct = FALSE;
|
6937 | 6979 | $$ = (Node *)n;
|
6938 | 6980 | }
|
6939 |
| - | select_with_parens %prec UMINUS |
6940 |
| - { |
6941 |
| - SubLink *n = makeNode(SubLink); |
6942 |
| - n->subLinkType = EXPR_SUBLINK; |
6943 |
| - n->lefthand = NIL; |
6944 |
| - n->operName = NIL; |
6945 |
| - n->subselect = $1; |
6946 |
| - $$ = (Node *)n; |
6947 |
| - } |
6948 |
| - | EXISTS select_with_parens |
6949 |
| - { |
6950 |
| - SubLink *n = makeNode(SubLink); |
6951 |
| - n->subLinkType = EXISTS_SUBLINK; |
6952 |
| - n->lefthand = NIL; |
6953 |
| - n->operName = NIL; |
6954 |
| - n->subselect = $2; |
6955 |
| - $$ = (Node *)n; |
6956 |
| - } |
6957 |
| - | ARRAY select_with_parens |
6958 |
| - { |
6959 |
| - SubLink *n = makeNode(SubLink); |
6960 |
| - n->subLinkType = ARRAY_SUBLINK; |
6961 |
| - n->lefthand = NIL; |
6962 |
| - n->operName = NIL; |
6963 |
| - n->subselect = $2; |
6964 |
| - $$ = (Node *)n; |
6965 |
| - } |
6966 |
| - | ARRAY array_expr |
6967 |
| - { $$ = $2; } |
6968 |
| - | row |
6969 |
| - { |
6970 |
| - RowExpr *r = makeNode(RowExpr); |
6971 |
| - r->args = $1; |
6972 |
| - r->row_typeid = InvalidOid; /* not analyzed yet */ |
6973 |
| - $$ = (Node *)r; |
6974 |
| - } |
6975 | 6981 | ;
|
6976 | 6982 |
|
6977 | 6983 | /*
|
|
0 commit comments