summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-05-13 16:26:07 +0400
committerAlexander Barkov <bar@mariadb.org>2016-05-13 16:26:07 +0400
commit81b4c5335e3d7a1aac28ac9f76d6be77d66d8d04 (patch)
treecbd46a0881e2c3c193ef844b67ab8a192b168a51
parentba500853d1900c001aa45594f1433880e32383df (diff)
downloadmariadb-git-81b4c5335e3d7a1aac28ac9f76d6be77d66d8d04.tar.gz
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.
-rw-r--r--sql/sql_yacc.yy28
1 files changed, 13 insertions, 15 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index a4d67a36d9c..9468254f40c 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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
@@ -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; }
@@ -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;