mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-18852 MDEV-18853 fix period.delete, period.update tests crashes with `--ps-protocol
The main problem was lack of proper QueryArena handling in `period_setup_conds`. Since mysql_prepare_update/mysql_prepare_delete are called during `PREPARE` statement, period conditions, should be allocated on statement query arena. Another problem is incorrect statement state handling in period_setup_conds, which led to unexpected mysql_update termination. * mysql_update: move period_setup_conds() to mysql_prepare_update to store conditions in statement's mem_root * mtr: add period suite to default list, since --ps-protocol is now fixed Fixes bugs: MDEV-18853 Assertion `0' failed in Protocol::end_statement upon DELETE .. FOR PORTION via prepared statement MDEV-18852 Server crashes in reinit_stmt_before_use upon UPDATE .. FOR PORTION via prepared statement
This commit is contained in:
committed by
Sergei Golubchik
parent
74c9872a9a
commit
04055060b6
@@ -432,6 +432,16 @@ int mysql_update(THD *thd,
|
||||
if (mysql_prepare_update(thd, table_list, &conds, order_num, order))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (table_list->has_period())
|
||||
{
|
||||
if (!table_list->period_conditions.start.item->const_item()
|
||||
|| !table_list->period_conditions.end.item->const_item())
|
||||
{
|
||||
my_error(ER_NOT_CONSTANT_EXPRESSION, MYF(0), "FOR PORTION OF");
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
}
|
||||
|
||||
old_covering_keys= table->covering_keys; // Keys used in WHERE
|
||||
/* Check the fields we are going to modify */
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
@@ -1366,15 +1376,6 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
||||
setup_ftfuncs(select_lex))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (table_list->has_period())
|
||||
{
|
||||
if (!table_list->period_conditions.start.item->const_item()
|
||||
|| !table_list->period_conditions.end.item->const_item())
|
||||
{
|
||||
my_error(ER_NOT_CONSTANT_EXPRESSION, MYF(0), "FOR PORTION OF");
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
}
|
||||
|
||||
select_lex->fix_prepare_information(thd, conds, &fake_conds);
|
||||
DBUG_RETURN(FALSE);
|
||||
@@ -1665,6 +1666,17 @@ int mysql_multi_update_prepare(THD *thd)
|
||||
if (mysql_handle_derived(lex, DT_PREPARE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (table_list->has_period())
|
||||
{
|
||||
/*
|
||||
Multi-table update is not supported on syntax lexel. However it's possible
|
||||
to get here through PREPARE with update of multi-table view.
|
||||
*/
|
||||
DBUG_ASSERT(table_list->is_view_or_derived());
|
||||
my_error(ER_IT_IS_A_VIEW, MYF(0), table_list->table_name.str);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (setup_tables_and_check_access(thd,
|
||||
&lex->first_select_lex()->context,
|
||||
&lex->first_select_lex()->top_join_list,
|
||||
|
||||
Reference in New Issue
Block a user