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

MDEV-21234 Server crashes in in setup_on_expr upon 3rd execution of SP

Versioned conditions in on_expr can not be rebuilt at optimization
stage on non-conventional arena.
This commit is contained in:
Aleksey Midenkov
2019-12-05 23:45:57 +03:00
parent 1fbd9bb2c5
commit be92dce613
3 changed files with 67 additions and 1 deletions

View File

@ -1713,7 +1713,20 @@ JOIN::optimize_inner()
}
}
conds= optimize_cond(this, conds, join_list, FALSE,
bool ignore_on_expr= false;
/*
PS/SP note: on_expr of versioned table can not be reallocated
(see build_equal_items() below) because it can be not rebuilt
at second invocation.
*/
if (!thd->stmt_arena->is_conventional() && thd->mem_root != thd->stmt_arena->mem_root)
for (TABLE_LIST *tbl= tables_list; tbl; tbl= tbl->next_local)
if (tbl->table && tbl->on_expr && tbl->table->versioned())
{
ignore_on_expr= true;
break;
}
conds= optimize_cond(this, conds, join_list, ignore_on_expr,
&cond_value, &cond_equal, OPT_LINK_EQUAL_FIELDS);
if (thd->is_error())