mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-17055: Server crashes in find_order_in_list upon 2nd (3rd) execution of SP with UPDATE
1. Always drop merged_for_insert flag on cleanup (there could be errors which prevent TABLE to be assigned) 2. Make more precise cleanup of select parts which was touched
This commit is contained in:
@ -2496,7 +2496,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
|
||||
}
|
||||
for (; sl; sl= sl->next_select_in_list())
|
||||
{
|
||||
if (!sl->first_execution)
|
||||
if (sl->changed_elements & TOUCHED_SEL_COND)
|
||||
{
|
||||
/* remove option which was put by mysql_explain_union() */
|
||||
sl->options&= ~SELECT_DESCRIBE;
|
||||
@ -2543,19 +2543,28 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
|
||||
order->next= sl->group_list_ptrs->at(ix+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
{ // no harm to do it (item_ptr set on parsing)
|
||||
ORDER *order;
|
||||
for (order= sl->group_list.first; order; order= order->next)
|
||||
{
|
||||
order->item= &order->item_ptr;
|
||||
}
|
||||
/* Fix ORDER list */
|
||||
for (order= sl->order_list.first; order; order= order->next)
|
||||
order->item= &order->item_ptr;
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
bool res=
|
||||
#endif
|
||||
sl->handle_derived(lex, DT_REINIT);
|
||||
DBUG_ASSERT(res == 0);
|
||||
order->item= &order->item_ptr;
|
||||
}
|
||||
}
|
||||
if (sl->changed_elements & TOUCHED_SEL_DERIVED)
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
bool res=
|
||||
#endif
|
||||
sl->handle_derived(lex, DT_REINIT);
|
||||
DBUG_ASSERT(res == 0);
|
||||
}
|
||||
|
||||
{
|
||||
SELECT_LEX_UNIT *unit= sl->master_unit();
|
||||
unit->unclean();
|
||||
|
Reference in New Issue
Block a user