summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test63
1 files changed, 62 insertions, 1 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 9db6709a8d2..0fb3474f877 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9209,5 +9209,66 @@ DROP FUNCTION f2;
DROP FUNCTION f3;
DROP FUNCTION f4;
---echo # End of 5.5 test
+--echo
+--echo Stored procedures and a condition handler in a nested procedure call
+--echo doesn't suppress the condition from being passed on to the calling
+--echo procedure
+--echo
+
+--disable_warnings
+drop procedure if exists p1;
+drop procedure if exists p0;
+--enable_warnings
+
+create table t1 (id int);
+delimiter $$;
+create procedure p1 () begin
+declare i int default 0;
+declare continue handler for not found begin
+select "You should see this message and the warning that generated this" as "message";
+show warnings;
+end;
+select id into i from t1;
+end$$
+create procedure p0 () begin
+declare continue handler for not found begin
+select "You should NOT see this message" as "message";
+end;
+call p1();
+end$$
+delimiter ;$$
+call p0();
+drop procedure p1;
+drop procedure p0;
+drop table t1;
+
+--echo
+--echo Test if stored procedures propagates errors
+--echo
+
+create table t1 (id int primary key);
+delimiter $$;
+create procedure p1 () begin
+insert into t1 values(1);
+insert into t1 values(2);
+insert into t1 values(2);
+insert into t1 values(3);
+end$$
+create procedure p2 () begin
+ declare x int;
+ select id into x from t1 where id=5;
+end$$
+delimiter ;$$
+--error ER_DUP_ENTRY
+call p1();
+show warnings;
+select * from t1;
+call p2();
+
+drop procedure p1;
+drop procedure p2;
+
+drop table t1;
+
+--echo # End of 5.5 test