Bug #12722 recursive call in stored function no longer allowed
Submitted: 22 Aug 2005 13:27 Modified: 22 Aug 2005 14:33
Reporter: Rupert Barnes Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.11-beta-standard OS:Linux (fedora core 3)
Assigned to: CPU Architecture:Any

[22 Aug 2005 13:27] Rupert Barnes
Description:
I have a stored function which does multiple string replaces.  This uses a recursive function call and works in 5.0.7 correctly.

In version 5.0.11 I suddenly can no longer do this and the error returned is 

ERROR 1424 (HY000) Recursive stored routines are not allowed

We have a lot of software using this function 

Please advise why this has suddenly happened,

Regards

Rupert Barnes

How to repeat:
This simplistic function demonstrates the problem 

create function rec
(
  p_num int(11)
)
returns int(11)
begin
if (p_num < 1)
then
  return 1;
end if;
return (2 * rec(p_num-1));
end;
[22 Aug 2005 14:33] MySQL Verification Team
This was documented:
http://dev.mysql.com/doc/mysql/en/news-5-0-9.html

Recursion in stored routines is now disabled because it was crashing the server. We plan to modify stored routines to allow this to operate safely in a future release. (Bug #11394)

Thank you for the bug report.