1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-17894 Assertion `(thd->lex)->current_select' failed in MYSQLparse(),

query with VALUES()

A table value constructor can be used in all contexts where a select
can be used. In particular an ORDER BY clause or a LIMIT clause or both
of them can be attached to a table value constructor to produce a new
query. Unfortunately execution of such queries was not supported.
This patch fixes the problem.
This commit is contained in:
Igor Babaev
2019-05-08 00:08:09 -07:00
parent 9d805004d8
commit 09aa5d3f69
13 changed files with 1339 additions and 47 deletions

View File

@ -2292,6 +2292,7 @@ void st_select_lex_unit::init_query()
with_element= 0;
columns_are_renamed= false;
intersect_mark= NULL;
with_wrapped_tvc= false;
}
void st_select_lex::init_query()
@ -3428,6 +3429,19 @@ bool st_select_lex_unit::union_needs_tmp_table()
{
if (with_element && with_element->is_recursive)
return true;
if (!with_wrapped_tvc)
{
for (st_select_lex *sl= first_select(); sl; sl=sl->next_select())
{
if (sl->tvc && sl->tvc->to_be_wrapped_as_with_tail())
{
with_wrapped_tvc= true;
break;
}
}
}
if (with_wrapped_tvc)
return true;
return union_distinct != NULL ||
global_parameters()->order_list.elements != 0 ||
thd->lex->sql_command == SQLCOM_INSERT_SELECT ||
@ -8238,6 +8252,8 @@ bool LEX::tvc_finalize()
current_select->options))))
return true;
many_values.empty();
if (!current_select->master_unit()->fake_select_lex)
current_select->master_unit()->add_fake_select_lex(thd);
return false;
}