mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Fixed BUG#6022: Stored procedure shutdown problem with self-calling function.
Fixed the pre-caching of functions. It now gives the expected stack overrun error for functions recursing too deep.
This commit is contained in:
parent
bf60309ea2
commit
7944acbbfa
3 changed files with 33 additions and 1 deletions
|
@ -1934,6 +1934,19 @@ s1
|
|||
1
|
||||
drop procedure bug4905|
|
||||
drop table t3|
|
||||
drop function if exists bug6022|
|
||||
create function bug6022(x int) returns int
|
||||
begin
|
||||
if x < 0 then
|
||||
return 0;
|
||||
else
|
||||
return bug6022(x-1);
|
||||
end if;
|
||||
end|
|
||||
select bug6022(5)|
|
||||
bug6022(5)
|
||||
0
|
||||
drop function bug6022|
|
||||
drop table if exists fac|
|
||||
create table fac (n int unsigned not null primary key, f bigint unsigned)|
|
||||
create procedure ifac(n int unsigned)
|
||||
|
|
|
@ -2090,6 +2090,25 @@ select * from t3|
|
|||
drop procedure bug4905|
|
||||
drop table t3|
|
||||
|
||||
#
|
||||
# BUG#6022: Stored procedure shutdown problem with self-calling function.
|
||||
#
|
||||
--disable_warnings
|
||||
drop function if exists bug6022|
|
||||
--enable_warnings
|
||||
|
||||
create function bug6022(x int) returns int
|
||||
begin
|
||||
if x < 0 then
|
||||
return 0;
|
||||
else
|
||||
return bug6022(x-1);
|
||||
end if;
|
||||
end|
|
||||
|
||||
select bug6022(5)|
|
||||
drop function bug6022|
|
||||
|
||||
|
||||
#
|
||||
# Some "real" examples
|
||||
|
|
|
@ -990,12 +990,12 @@ sp_cache_functions(THD *thd, LEX *lex)
|
|||
if (db_find_routine(thd, TYPE_ENUM_FUNCTION, &name, &sp)
|
||||
== SP_OK)
|
||||
{
|
||||
sp_cache_insert(&thd->sp_func_cache, sp);
|
||||
ret= sp_cache_functions(thd, newlex);
|
||||
delete newlex;
|
||||
thd->lex= oldlex;
|
||||
if (ret)
|
||||
break;
|
||||
sp_cache_insert(&thd->sp_func_cache, sp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue