summaryrefslogtreecommitdiff
path: root/mysql-test/t/ps.test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-06-12 14:12:36 +0400
committerAlexander Barkov <bar@mariadb.com>2018-06-12 14:12:36 +0400
commitae0aefb1c522455b785c2e43636c482cd161e3de (patch)
treea25c8fd0172b5aaa3c18fc2355704d5c6d343cbf /mysql-test/t/ps.test
parent8f5f0575ab41bd03369ab1dc31425ef7ab1c6b10 (diff)
downloadmariadb-git-ae0aefb1c522455b785c2e43636c482cd161e3de.tar.gz
MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command
This problem was earlier fixed by MDEV-14603. Only adding 10.2 specific tests.
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r--mysql-test/t/ps.test56
1 files changed, 53 insertions, 3 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index e051cdce179..1c8595936cd 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -4386,9 +4386,6 @@ DROP TABLE t1;
--echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
--echo #
---echo #
---echo # End of 10.2 tests
---echo #
--echo #
@@ -4650,3 +4647,56 @@ execute stmt;
execute stmt;
execute stmt;
drop table t1;
+
+
+--echo #
+--echo # MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command
+--echo #
+
+CREATE ROLE testrole;
+DELIMITER /;
+CREATE OR REPLACE PROCEDURE p1()
+BEGIN
+END;
+/
+DELIMITER ;/
+
+DELIMITER /;
+CREATE PROCEDURE p2 (wgrp VARCHAR(10))
+BEGIN
+ EXECUTE IMMEDIATE concat('GRANT EXECUTE ON PROCEDURE p1 TO ',wgrp);
+END;
+/
+DELIMITER ;/
+CALL p2('testrole');
+DROP PROCEDURE p2;
+
+DELIMITER /;
+CREATE PROCEDURE p2 ()
+BEGIN
+ EXECUTE IMMEDIATE concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1'testrole');
+END;
+/
+DELIMITER ;/
+CALL p2();
+DROP PROCEDURE p2;
+
+DELIMITER /;
+CREATE PROCEDURE p2 ()
+BEGIN
+ PREPARE stmt FROM concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1' testrole');
+ EXECUTE stmt;
+ DEALLOCATE PREPARE stmt;
+END;
+/
+DELIMITER ;/
+CALL p2();
+DROP PROCEDURE p2;
+
+DROP PROCEDURE p1;
+DROP ROLE testrole;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #