mirror of
https://github.com/MariaDB/server.git
synced 2026-05-03 13:45:34 +02:00
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.
This commit is contained in:
parent
838b5378cb
commit
9a87702b03
4 changed files with 72 additions and 9 deletions
|
|
@ -494,17 +494,10 @@ db_create_routine(THD *thd, int type, sp_head *sp)
|
|||
char definer[USER_HOST_BUFF_SIZE];
|
||||
char old_db_buf[NAME_LEN+1];
|
||||
LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
|
||||
bool dbchanged;
|
||||
DBUG_ENTER("db_create_routine");
|
||||
DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length,
|
||||
sp->m_name.str));
|
||||
|
||||
if ((ret= sp_use_new_db(thd, sp->m_db, &old_db, 0, &dbchanged)))
|
||||
{
|
||||
ret= SP_NO_DB_ERROR;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!(table= open_proc_table_for_update(thd)))
|
||||
ret= SP_OPEN_TABLE_FAILED;
|
||||
else
|
||||
|
|
@ -629,8 +622,6 @@ db_create_routine(THD *thd, int type, sp_head *sp)
|
|||
|
||||
done:
|
||||
close_thread_tables(thd);
|
||||
if (dbchanged)
|
||||
(void) mysql_change_db(thd, old_db.str, 1);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue