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

Fix of prepared CREATE VIEW with global ORDER/GROUP

This commit is contained in:
Oleksandr Byelkin
2019-03-07 11:30:06 +01:00
committed by Sergei Golubchik
parent 83123412f0
commit bc8ae50e7c

View File

@ -661,16 +661,6 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
allocation in setup_ref_array().
*/
fake_select_lex->n_child_sum_items+= global_parameters()->n_sum_items;
saved_error= fake_select_lex->join->
prepare(&fake_select_lex->ref_pointer_array,
fake_select_lex->table_list.first,
0, 0,
global_parameters()->order_list.elements, // og_num
global_parameters()->order_list.first, // order
false, NULL, NULL, NULL,
fake_select_lex, this);
fake_select_lex->table_list.empty();
}
}
else
@ -681,6 +671,27 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
*/
table->reset_item_list(&item_list);
}
if (fake_select_lex != NULL &&
(thd->stmt_arena->is_stmt_prepare() ||
(thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_VIEW)))
{
if (!fake_select_lex->join &&
!(fake_select_lex->join=
new JOIN(thd, item_list, thd->variables.option_bits, result)))
{
fake_select_lex->table_list.empty();
DBUG_RETURN(TRUE);
}
saved_error= fake_select_lex->join->
prepare(&fake_select_lex->ref_pointer_array,
fake_select_lex->table_list.first,
0, 0,
global_parameters()->order_list.elements, // og_num
global_parameters()->order_list.first, // order
false, NULL, NULL, NULL,
fake_select_lex, this);
fake_select_lex->table_list.empty();
}
}
thd_arg->lex->current_select= lex_select_save;