1
0
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:
dlenev@brandersnatch.localdomain
2005-06-20 16:07:00 +04:00
parent 362a45fd34
commit d07843efd9
3 changed files with 30 additions and 1 deletions

View File

@ -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