diff options
author | unknown <thek@kpdesk.mysql.com> | 2006-11-28 16:03:53 +0100 |
---|---|---|
committer | unknown <thek@kpdesk.mysql.com> | 2006-11-28 16:03:53 +0100 |
commit | 9a87702b033bc9bab337e716a52532c4e4599057 (patch) | |
tree | 25ad4a70172e5f683c2c197fdd1163ad383b295c /sql/sql_parse.cc | |
parent | 838b5378cb1998b27b106273f5e9043838888d39 (diff) | |
download | mariadb-git-9a87702b033bc9bab337e716a52532c4e4599057.tar.gz |
Bug#22043 MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE EXISTS"
- CREATE PROCEDURE stores database name based on query context instead
of 'current database' as set by 'USE' according to manual.
The bug reporter interpret the filtering statements as bug for
DROP PROCEDURE based on this behavior.
- Removed the code which changes db context.
- Added code to check that a valid db was supplied.
mysql-test/r/rpl_sp.result:
- Added test case (result)
mysql-test/t/rpl_sp.test:
- Added test case
sql/sp.cc:
- Removed code for changing current db context.
sql/sql_parse.cc:
- Added code to check if a valid db was supplied.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3a107c2296c..2feaebdde25 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4226,6 +4226,30 @@ end_with_restore_list: DBUG_ASSERT(lex->sphead != 0); DBUG_ASSERT(lex->sphead->m_db.str); /* Must be initialized in the parser */ + /* + Verify that the database name is allowed, optionally + lowercase it. + */ + if (check_db_name(lex->sphead->m_db.str)) + { + my_error(ER_WRONG_DB_NAME, MYF(0), lex->sphead->m_db.str); + delete lex->sphead; + lex->sphead= 0; + goto error; + } + + /* + Check that a database with this name + exists. + */ + if (check_db_dir_existence(lex->sphead->m_db.str)) + { + my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str); + delete lex->sphead; + lex->sphead= 0; + goto error; + } + if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, 0, 0, 0, is_schema_db(lex->sphead->m_db.str))) { |