mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#13684: SP: DROP PROCEDURE|FUNCTION IF EXISTS not binlogged if
routine does not exist There is an inconsistency with DROP DATABASE IF EXISTS, DROP TABLE IF EXISTS and DROP VIEW IF EXISTS: those are binlogged even if the DB or TABLE does not exist, whereas DROP PROCEDURE IF EXISTS does not. It would be nice or at least consistent if DROP PROCEDURE/STATEMENT worked the same too. Fixed DROP PROCEDURE|FUNCTION IF EXISTS by adding a call to mysql_bin_log.write in mysql_execute_command. Checked also if all documented "DROP (...) IF EXISTS" get binlogged. NOTE: This is a 5.0 backport patch as requested by support. mysql-test/r/rpl_drop_if_exists.result: Result file for test case added. mysql-test/r/rpl_sp.result: Updated result file for existing test case that has now extra events in binary log (the ones from drop if exists procedure/function). mysql-test/t/rpl_drop_if_exists.test: Added test case for asserting validity of proposed patch. sql/sql_parse.cc: Added call mysql_bin_log.write when lex has drop_if_exists enabled for stored procedures.
This commit is contained in:
@ -5067,6 +5067,14 @@ create_sp_error:
|
||||
case SP_KEY_NOT_FOUND:
|
||||
if (lex->drop_if_exists)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
/* using_trans */ 0,
|
||||
/* suppress use */ FALSE,
|
||||
THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||
ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
|
||||
SP_COM_STRING(lex), lex->spname->m_name.str);
|
||||
|
Reference in New Issue
Block a user