1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext

Conflicts:
	sql/sp_rcontext.cc
This commit is contained in:
Monty
2018-01-21 20:32:48 +02:00
18 changed files with 381 additions and 66 deletions

View File

@ -4357,6 +4357,9 @@ table_map subselect_union_engine::upper_select_const_tables()
void subselect_single_select_engine::print(String *str,
enum_query_type query_type)
{
With_clause* with_clause= select_lex->get_with_clause();
if (with_clause)
with_clause->print(str, query_type);
select_lex->print(get_thd(), str, query_type);
}

View File

@ -68,6 +68,7 @@ sp_rcontext *sp_rcontext::create(THD *thd,
Field *return_value_fld,
Row_definition_list &field_def_lst)
{
SELECT_LEX *save_current_select;
sp_rcontext *ctx= new (thd->mem_root) sp_rcontext(owner,
root_parsing_ctx,
return_value_fld,
@ -75,14 +76,19 @@ sp_rcontext *sp_rcontext::create(THD *thd,
if (!ctx)
return NULL;
/* Reset current_select as it's checked in Item_ident::Item_ident */
save_current_select= thd->lex->current_select;
thd->lex->current_select= 0;
if (ctx->alloc_arrays(thd) ||
ctx->init_var_table(thd, field_def_lst) ||
ctx->init_var_items(thd, field_def_lst))
{
delete ctx;
return NULL;
ctx= 0;
}
thd->lex->current_select= save_current_select;
return ctx;
}

View File

@ -2898,6 +2898,12 @@ static bool do_execute_sp(THD *thd, sp_head *sp)
ha_rows select_limit= thd->variables.select_limit;
thd->variables.select_limit= HA_POS_ERROR;
/*
Reset current_select as it may point to random data as a
result of previous parsing.
*/
thd->lex->current_select= NULL;
/*
We never write CALL statements into binlog:
- If the mode is non-prelocked, each statement will be logged