mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fix for bug #11060 "Server crashes on re-execution of prepared
INSERT ... SELECT with UNION" (reviewed version). Altough bug manifest itself only starting from 5.0 it is better to apply fix to 4.1 to keep some assumptions true and make code more future-proof.
This commit is contained in:
@ -1578,10 +1578,21 @@ bool delayed_insert::handle_inserts(void)
|
||||
int
|
||||
select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
||||
{
|
||||
int res;
|
||||
LEX *lex= thd->lex;
|
||||
SELECT_LEX *lex_current_select_save= lex->current_select;
|
||||
DBUG_ENTER("select_insert::prepare");
|
||||
|
||||
unit= u;
|
||||
if (check_insert_fields(thd, table, *fields, values))
|
||||
/*
|
||||
Since table in which we are going to insert is added to the first
|
||||
select, LEX::current_select should point to the first select while
|
||||
we are fixing fields from insert list.
|
||||
*/
|
||||
lex->current_select= &lex->select_lex;
|
||||
res= check_insert_fields(thd, table, *fields, values);
|
||||
lex->current_select= lex_current_select_save;
|
||||
if (res)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
restore_record(table,default_values); // Get empty record
|
||||
|
Reference in New Issue
Block a user