diff options
author | Luis Soares <luis.soares@sun.com> | 2009-04-09 11:40:22 +0100 |
---|---|---|
committer | Luis Soares <luis.soares@sun.com> | 2009-04-09 11:40:22 +0100 |
commit | 84ae9ecab0f3761d8086bce4c2f8dfbcfd43f31e (patch) | |
tree | 9566b5fbaeba96425b3afeb35c89de739847b596 /sql/sql_parse.cc | |
parent | 1db674f5c7843502a2c5a77b2a2be57f2a2b9240 (diff) | |
download | mariadb-git-84ae9ecab0f3761d8086bce4c2f8dfbcfd43f31e.tar.gz |
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.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e4618874fb9..7fbe6b86fbd 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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); |