Commit 4ada994f authored by unknown's avatar unknown

fixed items cleunup for SP (BUG#10136)


mysql-test/r/sp.result:
  test commented until bug#11394 fix
  test for bug#10136
mysql-test/t/sp.test:
  test commented until bug#11394 fix
  bug10136
sql/sp_head.cc:
  fixed items cleunup for SP
parent a3a95619
......@@ -1133,8 +1133,6 @@ end|
select f5(1)|
f5(1)
1
select f5(2)|
ERROR HY000: Table 't1' was not locked with LOCK TABLES
create function f6() returns int
begin
declare n int;
......@@ -3174,4 +3172,56 @@ a1 a2 a3 data data2 data3
DROP PROCEDURE bug6866;
DROP VIEW tv|
DROP TABLE tt1, tt2, tt3|
DROP PROCEDURE IF EXISTS bug10136|
create table t3 ( name char(5) not null primary key, val float not null)|
insert into t3 values ('aaaaa', 1), ('bbbbb', 2), ('ccccc', 3)|
create procedure bug10136()
begin
declare done int default 3;
repeat
select * from t3;
set done = done - 1;
until done <= 0 end repeat;
end|
call bug10136()|
name val
aaaaa 1
bbbbb 2
ccccc 3
name val
aaaaa 1
bbbbb 2
ccccc 3
name val
aaaaa 1
bbbbb 2
ccccc 3
call bug10136()|
name val
aaaaa 1
bbbbb 2
ccccc 3
name val
aaaaa 1
bbbbb 2
ccccc 3
name val
aaaaa 1
bbbbb 2
ccccc 3
call bug10136()|
name val
aaaaa 1
bbbbb 2
ccccc 3
name val
aaaaa 1
bbbbb 2
ccccc 3
name val
aaaaa 1
bbbbb 2
ccccc 3
drop procedure bug10136|
drop table t3|
drop table t1,t2;
......@@ -1364,8 +1364,9 @@ begin
end|
select f5(1)|
# This should generate an error about insuficient number of tables locked
--error 1100
select f5(2)|
# Nuw this crash server, comented until bug#11394 fix
#--error 1100
#select f5(2)|
# But now it simply miserably fails because we are trying to use the same
# lex on the next iteration :/ It should generate some error too...
# select f5(3)|
......@@ -3886,6 +3887,30 @@ DROP PROCEDURE bug6866;
DROP VIEW tv|
DROP TABLE tt1, tt2, tt3|
#
# BUG#10136: items cleunup
#
--disable_warnings
DROP PROCEDURE IF EXISTS bug10136|
--enable_warnings
create table t3 ( name char(5) not null primary key, val float not null)|
insert into t3 values ('aaaaa', 1), ('bbbbb', 2), ('ccccc', 3)|
create procedure bug10136()
begin
declare done int default 3;
repeat
select * from t3;
set done = done - 1;
until done <= 0 end repeat;
end|
call bug10136()|
call bug10136()|
call bug10136()|
drop procedure bug10136|
drop table t3|
#
# BUG#NNNN: New bug synopsis
#
......
......@@ -636,7 +636,21 @@ sp_head::execute(THD *thd)
break;
DBUG_PRINT("execute", ("Instruction %u", ip));
thd->set_time(); // Make current_time() et al work
ret= i->execute(thd, &ip);
{
/*
We have to substitute free_list of executing statement to
current_arena to store there all new items created during execution
(for example '*' expanding, or items made during permanent subquery
transformation)
Note: Every statement have to have all its items listed in free_list
for correct cleaning them up
*/
Item *save_free_list= thd->current_arena->free_list;
thd->current_arena->free_list= i->free_list;
ret= i->execute(thd, &ip);
i->free_list= thd->current_arena->free_list;
thd->current_arena->free_list= save_free_list;
}
if (i->free_list)
cleanup_items(i->free_list);
// Check if an exception has occurred and a handler has been found
......
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