Skip to content

Commit ed6d8ff

Browse files
author
Aleksandr Parfenov
committed
Fix gram to support complex expressions without parentheses
1 parent 02b3890 commit ed6d8ff

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

src/backend/parser/gram.y

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,8 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
587587
%type <ival> dictionary_map_set_expr_operator
588588
%type <dmapelem> dictionary_map_dict dictionary_map_command_expr_paren
589589
dictionary_map_set_expr dictionary_map_case
590-
dictionary_map_action dictionary_map
591-
opt_dictionary_map_case_else dictionary_config
592-
dictionary_config_comma
590+
dictionary_map_action opt_dictionary_map_case_else
591+
dictionary_config dictionary_config_comma
593592

594593
/*
595594
* Non-keyword token types. These are hard-wired into the "flex" lexer.
@@ -10449,7 +10448,7 @@ dictionary_config_comma:
1044910448
;
1045010449

1045110450
dictionary_config:
10452-
dictionary_map { $$ = $1; }
10451+
dictionary_map_set_expr { $$ = $1; }
1045310452
| dictionary_map_dict ',' dictionary_config_comma
1045410453
{
1045510454
DictMapExprElem *n = makeNode(DictMapExprElem);
@@ -10465,11 +10464,6 @@ dictionary_config:
1046510464
}
1046610465
;
1046710466

10468-
dictionary_map:
10469-
dictionary_map_case { $$ = $1; }
10470-
| dictionary_map_set_expr { $$ = $1; }
10471-
;
10472-
1047310467
dictionary_map_action:
1047410468
KEEP
1047510469
{
@@ -10478,16 +10472,16 @@ dictionary_map_action:
1047810472
n->data = NULL;
1047910473
$$ = n;
1048010474
}
10481-
| dictionary_map { $$ = $1; }
10475+
| dictionary_map_set_expr { $$ = $1; }
1048210476
;
1048310477

1048410478
opt_dictionary_map_case_else:
10485-
ELSE dictionary_map { $$ = $2; }
10479+
ELSE dictionary_map_set_expr { $$ = $2; }
1048610480
| { $$ = NULL; }
1048710481
;
1048810482

1048910483
dictionary_map_case:
10490-
CASE dictionary_map WHEN opt_dictionary_map_no MATCH THEN dictionary_map_action opt_dictionary_map_case_else END_P
10484+
CASE dictionary_map_set_expr WHEN opt_dictionary_map_no MATCH THEN dictionary_map_action opt_dictionary_map_case_else END_P
1049110485
{
1049210486
DictMapCase *n = makeNode(DictMapCase);
1049310487
DictMapElem *r = makeNode(DictMapElem);
@@ -10512,20 +10506,7 @@ dictionary_map_set_expr_operator:
1051210506

1051310507
dictionary_map_set_expr:
1051410508
dictionary_map_command_expr_paren { $$ = $1; }
10515-
| dictionary_map_case dictionary_map_set_expr_operator dictionary_map_case
10516-
{
10517-
DictMapExprElem *n = makeNode(DictMapExprElem);
10518-
DictMapElem *r = makeNode(DictMapElem);
10519-
10520-
n->left = $1;
10521-
n->oper = $2;
10522-
n->right = $3;
10523-
10524-
r->kind = DICT_MAP_EXPRESSION;
10525-
r->data = n;
10526-
$$ = r;
10527-
}
10528-
| dictionary_map_command_expr_paren dictionary_map_set_expr_operator dictionary_map_command_expr_paren
10509+
| dictionary_map_set_expr dictionary_map_set_expr_operator dictionary_map_command_expr_paren
1052910510
{
1053010511
DictMapExprElem *n = makeNode(DictMapExprElem);
1053110512
DictMapElem *r = makeNode(DictMapElem);
@@ -10543,6 +10524,7 @@ dictionary_map_set_expr:
1054310524
dictionary_map_command_expr_paren:
1054410525
'(' dictionary_map_set_expr ')' { $$ = $2; }
1054510526
| dictionary_map_dict { $$ = $1; }
10527+
| dictionary_map_case { $$ = $1; }
1054610528
;
1054710529

1054810530
dictionary_map_dict:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy