mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
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.
This commit is contained in:
parent
8f5f0575ab
commit
ae0aefb1c5
2 changed files with 89 additions and 6 deletions
|
@ -4918,9 +4918,6 @@ DROP TABLE t1;
|
|||
# End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
|
||||
#
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter
|
||||
#
|
||||
CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL);
|
||||
|
@ -5174,3 +5171,39 @@ execute stmt;
|
|||
execute stmt;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command
|
||||
#
|
||||
CREATE ROLE testrole;
|
||||
CREATE OR REPLACE PROCEDURE p1()
|
||||
BEGIN
|
||||
END;
|
||||
/
|
||||
CREATE PROCEDURE p2 (wgrp VARCHAR(10))
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE concat('GRANT EXECUTE ON PROCEDURE p1 TO ',wgrp);
|
||||
END;
|
||||
/
|
||||
CALL p2('testrole');
|
||||
DROP PROCEDURE p2;
|
||||
CREATE PROCEDURE p2 ()
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1'testrole');
|
||||
END;
|
||||
/
|
||||
CALL p2();
|
||||
DROP PROCEDURE p2;
|
||||
CREATE PROCEDURE p2 ()
|
||||
BEGIN
|
||||
PREPARE stmt FROM concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1' testrole');
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
CALL p2();
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p1;
|
||||
DROP ROLE testrole;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
|
|
@ -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 #
|
||||
|
|
Loading…
Reference in a new issue