Commit 81b4c533 authored by Alexander Barkov's avatar Alexander Barkov

sql_yacc.yy: adding a new rule union_head_non_top, to reuse some code

between select_derived_union and query_expression_body.
An upcoming patch for MDEV-10035 will also reuse union_head_non_top.
parent ba500853
...@@ -11112,14 +11112,7 @@ select_derived_union: ...@@ -11112,14 +11112,7 @@ select_derived_union:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
| select_derived_union | select_derived_union union_head_non_top query_term
UNION_SYM
union_option
{
if (add_select_to_union_list(Lex, (bool)$3, FALSE))
MYSQL_YYABORT;
}
query_term
{ {
/* /*
Remove from the name resolution context stack the context of the Remove from the name resolution context stack the context of the
...@@ -16349,6 +16342,17 @@ order_or_limit: ...@@ -16349,6 +16342,17 @@ order_or_limit:
| limit_clause | limit_clause
; ;
/*
Start a UNION, for non-top level query expressions.
*/
union_head_non_top:
UNION_SYM union_option
{
if (add_select_to_union_list(Lex, (bool)$2, FALSE))
MYSQL_YYABORT;
}
;
union_option: union_option:
/* empty */ { $$=1; } /* empty */ { $$=1; }
| DISTINCT { $$=1; } | DISTINCT { $$=1; }
...@@ -16373,13 +16377,7 @@ query_term: ...@@ -16373,13 +16377,7 @@ query_term:
query_expression_body: query_expression_body:
query_term query_term
| query_expression_body | query_expression_body union_head_non_top query_term
UNION_SYM union_option
{
if (add_select_to_union_list(Lex, (bool)$3, FALSE))
MYSQL_YYABORT;
}
query_term
{ {
Lex->pop_context(); Lex->pop_context();
$$= $1; $$= $1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment