mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-33386 Wrong error message on GRANT .. ON PACKAGE no_such_package ..
When displaying the ER_SP_DOES_NOT_EXIST error, use Sp_handler::type_lex_cstring() to the the underlying object type: - PROCEDURE - FUNCTION - PACKAGE - PACKAGE BODY instead of hard-coded "FUNCTION or PROCEDURE".
This commit is contained in:
@ -2662,9 +2662,9 @@ create database mysqltest_db1;
|
|||||||
create user mysqltest_u1;
|
create user mysqltest_u1;
|
||||||
# Both GRANT statements below should fail with the same error.
|
# Both GRANT statements below should fail with the same error.
|
||||||
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
|
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
|
||||||
ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
|
ERROR 42000: FUNCTION f1 does not exist
|
||||||
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
|
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
|
||||||
ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
|
ERROR 42000: PROCEDURE p1 does not exist
|
||||||
# Let us show that GRANT behaviour for routines is consistent
|
# Let us show that GRANT behaviour for routines is consistent
|
||||||
# with GRANT behaviour for tables. Attempt to grant privilege
|
# with GRANT behaviour for tables. Attempt to grant privilege
|
||||||
# on non-existent table also results in an error.
|
# on non-existent table also results in an error.
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#
|
||||||
|
# Start of 11.4 tests
|
||||||
|
#
|
||||||
CREATE DATABASE db1;
|
CREATE DATABASE db1;
|
||||||
CREATE USER u1@localhost IDENTIFIED BY '';
|
CREATE USER u1@localhost IDENTIFIED BY '';
|
||||||
GRANT SELECT ON db1.* TO u1@localhost;
|
GRANT SELECT ON db1.* TO u1@localhost;
|
||||||
@ -307,3 +310,13 @@ SESSION_USER() CURRENT_USER() msg
|
|||||||
root@localhost root@localhost p1.p1
|
root@localhost root@localhost p1.p1
|
||||||
DROP PACKAGE p1;
|
DROP PACKAGE p1;
|
||||||
DROP USER xxx@localhost;
|
DROP USER xxx@localhost;
|
||||||
|
#
|
||||||
|
# MDEV-33386 Wrong error message on `GRANT .. ON PACKAGE no_such_package ..`
|
||||||
|
#
|
||||||
|
GRANT EXECUTE ON PACKAGE no_such_package TO PUBLIC;
|
||||||
|
ERROR 42000: PACKAGE no_such_package does not exist
|
||||||
|
GRANT EXECUTE ON PACKAGE BODY no_such_package TO PUBLIC;
|
||||||
|
ERROR 42000: PACKAGE BODY no_such_package does not exist
|
||||||
|
#
|
||||||
|
# End of 11.4 tests
|
||||||
|
#
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
--source include/not_embedded.inc
|
--source include/not_embedded.inc
|
||||||
--source include/default_charset.inc
|
--source include/default_charset.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Start of 11.4 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
CREATE DATABASE db1;
|
CREATE DATABASE db1;
|
||||||
CREATE USER u1@localhost IDENTIFIED BY '';
|
CREATE USER u1@localhost IDENTIFIED BY '';
|
||||||
GRANT SELECT ON db1.* TO u1@localhost;
|
GRANT SELECT ON db1.* TO u1@localhost;
|
||||||
@ -320,3 +324,17 @@ DELIMITER ;$$
|
|||||||
CALL p1.p1;
|
CALL p1.p1;
|
||||||
DROP PACKAGE p1;
|
DROP PACKAGE p1;
|
||||||
DROP USER xxx@localhost;
|
DROP USER xxx@localhost;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-33386 Wrong error message on `GRANT .. ON PACKAGE no_such_package ..`
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
|
GRANT EXECUTE ON PACKAGE no_such_package TO PUBLIC;
|
||||||
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
|
GRANT EXECUTE ON PACKAGE BODY no_such_package TO PUBLIC;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 11.4 tests
|
||||||
|
--echo #
|
||||||
|
@ -2291,7 +2291,7 @@ Sp_handler::sp_exist_routines(THD *thd, TABLE_LIST *routines) const
|
|||||||
thd->get_stmt_da()->clear_warning_info(thd->query_id);
|
thd->get_stmt_da()->clear_warning_info(thd->query_id);
|
||||||
if (! sp_object_found)
|
if (! sp_object_found)
|
||||||
{
|
{
|
||||||
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION or PROCEDURE",
|
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), type_lex_cstring().str,
|
||||||
routine->table_name.str);
|
routine->table_name.str);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user