Commit 1f4f7293 authored by Alexander Barkov's avatar Alexander Barkov

sql_yacc.yy cleanup, to simplify further changes for MDEV-8909.

- Moving "SELECT_SYM select_init2_derived opt_table_expression"
  from query_term into a new separate rule query_specification,
  and using query_specification in the beginning of query_term.
- query_term now does not have a %type, query_specification has a %type
  instead. This removes duplicate code that returns
  Lex->current_select->master_unit()->first_select();
parent b7994495
......@@ -1919,7 +1919,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <variable> internal_variable_name
%type <select_lex> subselect
get_select_lex query_term
get_select_lex
query_expression_body
%type <boolfunc2creator> comp_op
......@@ -16359,24 +16359,33 @@ union_option:
| ALL { $$=0; }
;
/*
Corresponds to the SQL Standard
<query specification> ::=
SELECT [ <set quantifier> ] <select list> <table expression>
Notes:
- We allow more options in addition to <set quantifier>
- <table expression> is optional in MariaDB
*/
query_specification:
SELECT_SYM select_init2_derived opt_table_expression
;
query_term:
SELECT_SYM select_init2_derived
opt_table_expression
query_specification
opt_order_clause
opt_limit_clause
opt_select_lock_type
{
$$= Lex->current_select->master_unit()->first_select();
}
| '(' select_paren_derived ')'
opt_union_order_or_limit
{
$$= Lex->current_select->master_unit()->first_select();
}
;
query_expression_body:
query_term
{
$$= Lex->current_select->master_unit()->first_select();
}
| query_expression_body union_head_non_top query_term
{
Lex->pop_context();
......@@ -16388,7 +16397,7 @@ query_expression_body:
subselect:
subselect_start opt_with_clause query_expression_body subselect_end
{
$3->set_with_clause($2);
$3->set_with_clause($2);
$$= $3;
}
;
......
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