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.


mysql-test/r/sp.result:
  New test case for BUG#6022.
mysql-test/t/sp.test:
  New test case for BUG#6022.
sql/sp.cc:
  Cache function first, then recurse, or the pre-caching loops infinitely
  for recursive functions.
This commit is contained in:
unknown 2004-10-23 13:30:05 +02:00
commit d925bcd8d6
3 changed files with 33 additions and 1 deletions

View file

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