From cc83bb07845eede90a713d93ae332a885dc0519b Mon Sep 17 00:00:00 2001 From: "anozdrin/alik@alik.opbmk" <> Date: Tue, 27 Mar 2007 21:55:01 +0400 Subject: Fix for BUG#25082: default database change on trigger execution breaks replication. When a stored routine is executed, we switch current database to the database, in which the routine has been created. When the stored routine finishes, we switch back to the original database. The problem was that if the original database does not exist (anymore) after routine execution, we raised an error. The fix is to report a warning, and switch to the NULL database. --- sql/sp_head.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sp_head.cc') diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 9d7fc55ff70..bba231ba685 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1130,7 +1130,7 @@ sp_head::execute(THD *thd) (It would generate an error from mysql_change_db() when old_db=="") */ if (! thd->killed) - err_status|= mysql_change_db(thd, old_db.str, 1); + err_status|= mysql_change_db(thd, &old_db, TRUE); } m_flags&= ~IS_INVOKED; DBUG_PRINT("info", -- cgit v1.2.1