Skip to content

Commit

Permalink
sql_yacc.yy: adding a new rule union_head_non_top, to reuse some code
Browse files Browse the repository at this point in the history
between select_derived_union and query_expression_body.
An upcoming patch for MDEV-10035 will also reuse union_head_non_top.
  • Loading branch information
Alexander Barkov committed May 13, 2016
1 parent ba50085 commit 81b4c53
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions sql/sql_yacc.yy
Original file line number Diff line number Diff line change
Expand Up @@ -11112,14 +11112,7 @@ select_derived_union:
MYSQL_YYABORT;
}
}
| select_derived_union
UNION_SYM
union_option
{
if (add_select_to_union_list(Lex, (bool)$3, FALSE))
MYSQL_YYABORT;
}
query_term
| select_derived_union union_head_non_top query_term
{
/*
Remove from the name resolution context stack the context of the
Expand Down Expand Up @@ -16349,6 +16342,17 @@ order_or_limit:
| 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:
/* empty */ { $$=1; }
| DISTINCT { $$=1; }
Expand All @@ -16373,13 +16377,7 @@ query_term:

query_expression_body:
query_term
| query_expression_body
UNION_SYM union_option
{
if (add_select_to_union_list(Lex, (bool)$3, FALSE))
MYSQL_YYABORT;
}
query_term
| query_expression_body union_head_non_top query_term
{
Lex->pop_context();
$$= $1;
Expand Down

0 comments on commit 81b4c53

Please sign in to comment.