summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authorunknown <Li-Bing.Song@sun.com>2009-08-13 10:48:57 +0800
committerunknown <Li-Bing.Song@sun.com>2009-08-13 10:48:57 +0800
commitfce4fa362c5234f1e85212060f61b842844192b7 (patch)
tree35a500b7817051b61aeb42aba97e0a4b6d6e774c /sql/sql_db.cc
parent89260b24c9334fb7357ed5fdac62e24c278cda3d (diff)
downloadmariadb-git-fce4fa362c5234f1e85212060f61b842844192b7.tar.gz
BUG#45574 CREATE IF NOT EXISTS is not binlogged if the object exists
There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are binlogged even if either the DB, TABLE or EVENT does not exist. In contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT exists. This patch fixes the following cases for all the replication formats: CREATE DATABASE IF NOT EXISTS. CREATE TABLE IF NOT EXISTS, CREATE TABLE IF NOT EXISTS ... LIKE, CREAET TABLE IF NOT EXISTS ... SELECT. sql/sql_insert.cc: Part of the code was moved from the create_table_from_items to select_create::prepare. When replication is row based, CREATE TABLE IF NOT EXISTS.. SELECT is binlogged if the table exists.
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 98d17fdd318..3fca5bd7df6 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -658,10 +658,8 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
}
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), db);
- if (!silent)
- my_ok(thd);
error= 0;
- goto exit;
+ goto not_silent;
}
else
{
@@ -698,7 +696,8 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
happened. (This is a very unlikely senario)
*/
}
-
+
+not_silent:
if (!silent)
{
char *query;