Commit c9629daa authored by Alexander Barkov's avatar Alexander Barkov

This patch is a cleanup simplifying upcoming

"MDEV-8909 union parser cleanup" changes.

When the server parses a query like
  SELECT * FROM (SELECT 1);
a sequence of calls
  st_select_lex::init_nested_join() ..
  st_select_lex::end_nested_join()
was performed two times (tested in gdb).
Both pairs of calls seem to be redundant for a query
like this, because there are actually no any joins here.

This patch moved "table_ref_select" inside "select_derived",
which revealed that one the pairs was definitely redundant:
After this transformation we got an init_nested_join()
immediately followed by end_nested_join() for the same st_select_lex,
which has no any sense. So this pair of calls was removed.
parent 50a17de1
......@@ -10990,23 +10990,6 @@ table_primary_ident:
}
;
table_ref_select:
select_derived_init get_select_lex select_derived2
{
LEX *lex= Lex;
SELECT_LEX *sel= lex->current_select;
if ($1)
{
if (sel->set_braces(1))
{
my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
if ($2->init_nested_join(lex->thd))
MYSQL_YYABORT;
}
;
/*
......@@ -11198,11 +11181,24 @@ select_derived:
MYSQL_YYABORT;
}
}
| get_select_lex_derived table_ref_select
| get_select_lex_derived select_derived_init
{
// Now we have the same st_select_lex that we had in the beginning
DBUG_ASSERT($1 == Lex->current_select);
}
select_derived2
{
LEX *lex= Lex;
$$= $1->end_nested_join(lex->thd);
DBUG_ASSERT($$ == NULL);
SELECT_LEX *sel= lex->current_select;
if ($2)
{
if (sel->set_braces(1))
{
my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
}
}
$$= NULL;
}
;
......
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