mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
MDEV-38472 Assertion in Diagnostics_area::set_error_status on UPDATE...LIMIT DEFAULT
Binding DEFAULT to a LIMIT ? placeholder via EXECUTE ... USING is never rejected at bind time. unit->set_limit() later evaluates it and sets ER_INVALID_DEFAULT_PARAM in the Diagnostics_area, but SQLCOM_UPDATE (and SQLCOM_UPDATE_MULTI, SQLCOM_INSERT_SELECT/REPLACE_SELECT) proceeded into open_tables() regardless. A concurrent metadata change (e.g. ALTER TABLE FORCE) then triggers Reprepare_observer::report_error(), which tries to set ER_NEED_REPREPARE on an already-set DA and hits the assert. Add the same thd->is_error() check after unit->set_limit() (as in SQLCOM_DELETE), aborting before open_tables() is reached.
This commit is contained in:
@@ -4491,6 +4491,8 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
||||
|
||||
DBUG_ASSERT(select_lex->limit_params.offset_limit == 0);
|
||||
unit->set_limit(select_lex);
|
||||
if (thd->is_error())
|
||||
goto error;
|
||||
MYSQL_UPDATE_START(thd->query());
|
||||
res= up_result= mysql_update(thd, all_tables,
|
||||
select_lex->item_list,
|
||||
@@ -4525,6 +4527,8 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
||||
res= 0;
|
||||
|
||||
unit->set_limit(select_lex);
|
||||
if (thd->is_error())
|
||||
goto error;
|
||||
/*
|
||||
We can not use mysql_explain_union() because of parameters of
|
||||
mysql_select in mysql_multi_update so just set the option if needed
|
||||
@@ -4740,6 +4744,8 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
||||
select_lex->options|= SELECT_NO_UNLOCK;
|
||||
|
||||
unit->set_limit(select_lex);
|
||||
if (thd->is_error())
|
||||
goto error;
|
||||
|
||||
if (!(res=open_and_lock_tables(thd, all_tables, TRUE, 0)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user