sp.test:

  test case for the fix for bug #2614
sp_head.cc:
  A fix for a crashing bug in stored procedures with INSERT ... SELECT ... (Bug #2514)
parent 52124c33
...@@ -1299,7 +1299,20 @@ show create procedure bar| ...@@ -1299,7 +1299,20 @@ show create procedure bar|
--replace_column 4 '0000-00-00 00:00:00' 5 '0000-00-00 00:00:00' --replace_column 4 '0000-00-00 00:00:00' 5 '0000-00-00 00:00:00'
show procedure status like 'bar'| show procedure status like 'bar'|
drop procedure bar| drop procedure bar|
delimiter ;| delimiter ;|
drop table t1; drop table t1;
drop table t2; drop table t2;
delimiter |
drop procedure if exists crash|
create procedure crash()
begin
drop table if exists t1;
create table t1 (id int default '0' not null);
insert into t1 select 12;
insert into t1 select * from t1;
end|
delimiter ;
call crash();
call crash();
drop table t1;
drop procedure if exists crash;
...@@ -852,6 +852,11 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex) ...@@ -852,6 +852,11 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
{ {
TABLE_LIST *tabs; TABLE_LIST *tabs;
if (lex->sql_command == SQLCOM_CREATE_TABLE ||
lex->sql_command == SQLCOM_INSERT_SELECT)
{ // Restore sl->table_list.first
sl->table_list.first= sl->table_list_first_copy;
}
// We have closed all tables, get rid of pointers to them // We have closed all tables, get rid of pointers to them
for (tabs=(TABLE_LIST *)sl->table_list.first ; for (tabs=(TABLE_LIST *)sl->table_list.first ;
tabs ; tabs ;
...@@ -859,11 +864,6 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex) ...@@ -859,11 +864,6 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
{ {
tabs->table= NULL; tabs->table= NULL;
} }
if (lex->sql_command == SQLCOM_CREATE_TABLE ||
lex->sql_command == SQLCOM_INSERT_SELECT)
{ // Restore sl->table_list.first
sl->table_list.first= sl->table_list_first_copy;
}
for (ORDER *order= (ORDER *)sl->order_list.first ; for (ORDER *order= (ORDER *)sl->order_list.first ;
order ; order ;
order= order->next) order= order->next)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment