summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp-bugs.test
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-02-03 15:22:39 +0100
committerSergei Golubchik <sergii@pisem.net>2014-02-03 15:22:39 +0100
commit72c20282db820b0b0818aea160a485bdca897eec (patch)
tree3089e022d958990fc0a405a38ba43ae00c87103c /mysql-test/t/sp-bugs.test
parent5e1d5d9bc0bf9ea776bffe6c4914a84be920c0b2 (diff)
parent2acc01b3cfa27074f93016b893cda20fa0a3497f (diff)
downloadmariadb-git-72c20282db820b0b0818aea160a485bdca897eec.tar.gz
10.0-base merge
Diffstat (limited to 'mysql-test/t/sp-bugs.test')
-rw-r--r--mysql-test/t/sp-bugs.test56
1 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test
index 1ec154f1c69..8e6a25709aa 100644
--- a/mysql-test/t/sp-bugs.test
+++ b/mysql-test/t/sp-bugs.test
@@ -238,3 +238,59 @@ DROP FUNCTION testf_bug11763507;
--echo #END OF BUG#11763507 test.
+--echo #
+--echo # MDEV-5531 double call procedure in one session
+--echo #
+
+CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `create_ts` int(10) unsigned DEFAULT '0',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
+
+DELIMITER $$;
+
+CREATE PROCEDURE test_5531 (IN step TINYINT(1))
+BEGIN
+ DECLARE counts INT DEFAULT 0;
+ DECLARE cur1 CURSOR FOR
+
+ SELECT ct.id
+ FROM (SELECT NULL) AS z
+ JOIN (
+ SELECT id
+ FROM `t1`
+ LIMIT 10
+ ) AS ct
+ JOIN (SELECT NULL) AS x ON(
+ EXISTS(
+ SELECT 1
+ FROM `t1`
+ WHERE id=ct.id
+ LIMIT 1
+ )
+ );
+
+ IF step=1 THEN
+ TRUNCATE t1;
+ REPEAT
+ INSERT INTO `t1`
+ (create_ts) VALUES
+ (UNIX_TIMESTAMP());
+
+ SET counts=counts+1;
+ UNTIL counts>150 END REPEAT;
+
+ SET max_sp_recursion_depth=1;
+
+ CALL test_5531(2);
+ SET max_sp_recursion_depth=2;
+ CALL test_5531(2);
+ ELSEIF step=2 THEN
+ OPEN cur1; CLOSE cur1;
+ END IF;
+END $$
+DELIMITER ;$$
+CALL test_5531(1);
+DROP PROCEDURE test_5531;
+DROP TABLE t1;