Commit 8c0129dc authored by Alexander Barkov's avatar Alexander Barkov

MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE

parent 2a1035b0
...@@ -755,3 +755,21 @@ GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'root'@'localhost' ...@@ -755,3 +755,21 @@ GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'root'@'localhost'
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
drop procedure sp1; drop procedure sp1;
set password=''; set password='';
#
# MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE
#
CREATE DATABASE u1;
CREATE PROCEDURE u1.p1() BEGIN SELECT 1; END; $$
CREATE FUNCTION u1.f1() RETURNS INT BEGIN RETURN 1; END; $$
CREATE USER u1@localhost;
GRANT CREATE ROUTINE ON u1.* TO u1@localhost;
GRANT ALTER ROUTINE ON FUNCTION u1.f1 TO u1@localhost;
GRANT ALTER ROUTINE ON PROCEDURE u1.p1 TO u1@localhost;
connect u1, localhost, u1,,;
USE u1;
CREATE OR REPLACE FUNCTION f1() RETURNS INT BEGIN RETURN 2; END; $$
CREATE OR REPLACE PROCEDURE p1() BEGIN SELECT 1; END; $$
disconnect u1;
connection default;
DROP DATABASE u1;
DROP USER u1@localhost;
...@@ -1023,3 +1023,30 @@ grant execute on procedure sp1 to current_user() identified by 'barfoo'; ...@@ -1023,3 +1023,30 @@ grant execute on procedure sp1 to current_user() identified by 'barfoo';
show grants; show grants;
drop procedure sp1; drop procedure sp1;
set password=''; set password='';
--echo #
--echo # MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE
--echo #
CREATE DATABASE u1;
DELIMITER $$;
CREATE PROCEDURE u1.p1() BEGIN SELECT 1; END; $$
CREATE FUNCTION u1.f1() RETURNS INT BEGIN RETURN 1; END; $$
DELIMITER ;$$
CREATE USER u1@localhost;
GRANT CREATE ROUTINE ON u1.* TO u1@localhost;
GRANT ALTER ROUTINE ON FUNCTION u1.f1 TO u1@localhost;
GRANT ALTER ROUTINE ON PROCEDURE u1.p1 TO u1@localhost;
connect (u1, localhost, u1,,);
USE u1;
DELIMITER $$;
CREATE OR REPLACE FUNCTION f1() RETURNS INT BEGIN RETURN 2; END; $$
CREATE OR REPLACE PROCEDURE p1() BEGIN SELECT 1; END; $$
DELIMITER ;$$
disconnect u1;
connection default;
DROP DATABASE u1;
DROP USER u1@localhost;
...@@ -5660,7 +5660,7 @@ mysql_execute_command(THD *thd) ...@@ -5660,7 +5660,7 @@ mysql_execute_command(THD *thd)
{ {
if (check_routine_access(thd, ALTER_PROC_ACL, lex->spname->m_db.str, if (check_routine_access(thd, ALTER_PROC_ACL, lex->spname->m_db.str,
lex->spname->m_name.str, lex->spname->m_name.str,
lex->sql_command == SQLCOM_DROP_PROCEDURE, 0)) lex->sql_command == SQLCOM_CREATE_PROCEDURE, 0))
goto error; goto error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment