Commit e2089cdd authored by unknown's avatar unknown

Fixed BUG#9674: Stored Procs: Using declared vars in algebric operation

                causes system crash.


mysql-test/r/sp.result:
  Added test case for BUG#9674.
mysql-test/t/sp.test:
  Added test case for BUG#9674.
sql/item.cc:
  Returning a pointer to a local variable is not a good idea.
  Better to use parameter which is there for exactly this purpose.
parent d6c2a1e3
......@@ -2880,4 +2880,32 @@ call bug9856()|
16
16
drop procedure bug9856|
drop procedure if exists bug9674_1|
drop procedure if exists bug9674_2|
create procedure bug9674_1(out arg int)
begin
declare temp_in1 int default 0;
declare temp_fl1 int default 0;
set temp_in1 = 100;
set temp_fl1 = temp_in1/10;
set arg = temp_fl1;
end|
create procedure bug9674_2()
begin
declare v int default 100;
select v/10;
end|
call bug9674_1(@sptmp)|
call bug9674_1(@sptmp)|
select @sptmp|
@sptmp
10
call bug9674_2()|
v/10
10.00000
call bug9674_2()|
v/10
10.00000
drop procedure bug9674_1|
drop procedure bug9674_2|
drop table t1,t2;
......@@ -3537,6 +3537,40 @@ call bug9856()|
drop procedure bug9856|
#
# BUG##9674: Stored Procs: Using declared vars in algebric operation causes
# system crash.
#
--disable_warnings
drop procedure if exists bug9674_1|
drop procedure if exists bug9674_2|
--enable_warnings
create procedure bug9674_1(out arg int)
begin
declare temp_in1 int default 0;
declare temp_fl1 int default 0;
set temp_in1 = 100;
set temp_fl1 = temp_in1/10;
set arg = temp_fl1;
end|
create procedure bug9674_2()
begin
declare v int default 100;
select v/10;
end|
call bug9674_1(@sptmp)|
call bug9674_1(@sptmp)|
select @sptmp|
call bug9674_2()|
call bug9674_2()|
drop procedure bug9674_1|
drop procedure bug9674_2|
#
# BUG#NNNN: New bug synopsis
#
......
......@@ -700,7 +700,7 @@ my_decimal *Item_splocal::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed);
Item *it= this_item();
my_decimal value, *val= it->val_decimal(&value);
my_decimal *val= it->val_decimal(decimal_value);
Item::null_value= it->null_value;
return val;
}
......
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