summaryrefslogtreecommitdiff
path: root/mysql-test/r/sp-error.result
diff options
context:
space:
mode:
authorunknown <dlenev@brandersnatch.localdomain>2005-07-01 13:01:46 +0400
committerunknown <dlenev@brandersnatch.localdomain>2005-07-01 13:01:46 +0400
commit0f64a495068bc8898c7269b495c76cb28624b50d (patch)
treef780b41399823750ea4737fc932dfa4c34d0319c /mysql-test/r/sp-error.result
parent17bd4e9f6a0c72aa9e7d10894edb6e8f97afb794 (diff)
downloadmariadb-git-0f64a495068bc8898c7269b495c76cb28624b50d.tar.gz
"Fix" for bug #11394 "Recursion in SP crash server" and bug #11600
"Stored procedures: crash with function calling itself". Disallow recursive stored routines until we either make Item's and LEX reentrant safe or will use spearate sp_head instances (and thus separate LEX objects and Item trees) for each routine invocation. mysql-test/r/sp-error.result: Added tests for bug #11394 "Recursion in SP crash server" and bug #11600 "Stored procedures: crash with function calling itself". (We simply disallow recursion for stored routines). mysql-test/r/sp.result: Disabled test cases containing recursive stored routines until we will support for them. mysql-test/t/sp-error.test: Added tests for bug #11394 "Recursion in SP crash server" and bug #11600 "Stored procedures: crash with function calling itself". (We simply disallow recursion for stored routines). mysql-test/t/sp.test: Disabled test cases containing recursive stored routines until we will support for them. sql/share/errmsg.txt: Added error message saying that recursive stored routines are disallowed. sql/sp_head.cc: sp_head::execute(): Since many Item's and LEX members can't be used in reentrant fashion we have to disable recursion for stored routines. So let us track routine invocations using sp_head::m_is_invoked member and raise error when one attempts to call routine recursively. sql/sp_head.h: sp_head: Added m_is_invoked member for tracking of routine invocations and preventing recursion.
Diffstat (limited to 'mysql-test/r/sp-error.result')
-rw-r--r--mysql-test/r/sp-error.result40
1 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index b6ba737a8ba..814abe4f56d 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -686,3 +686,43 @@ ERROR 0A000: EXECUTE is not allowed in stored procedures
create function f() returns int begin execute stmt;
ERROR 0A000: EXECUTE is not allowed in stored procedures
deallocate prepare stmt;
+drop function if exists bug11394|
+drop function if exists bug11394_1|
+drop function if exists bug11394_2|
+drop procedure if exists bug11394|
+create function bug11394(i int) returns int
+begin
+if i <= 0 then
+return 0;
+else
+return (i in (100, 200, bug11394(i-1), 400));
+end if;
+end|
+select bug11394(2)|
+ERROR HY000: Recursive stored routines are not allowed.
+drop function bug11394|
+create function bug11394_1(i int) returns int
+begin
+if i <= 0 then
+return 0;
+else
+return (select bug11394_1(i-1));
+end if;
+end|
+select bug11394_1(2)|
+ERROR HY000: Recursive stored routines are not allowed.
+drop function bug11394_1|
+create function bug11394_2(i int) returns int return i|
+select bug11394_2(bug11394_2(10))|
+bug11394_2(bug11394_2(10))
+10
+drop function bug11394_2|
+create procedure bug11394(i int, j int)
+begin
+if i > 0 then
+call bug11394(i - 1,(select 1));
+end if;
+end|
+call bug11394(2, 1)|
+ERROR HY000: Recursive stored routines are not allowed.
+drop procedure bug11394|