summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorVenkatesh Duggirala <venkatesh.duggirala@oracle.com>2015-03-13 12:32:44 +0530
committerVenkatesh Duggirala <venkatesh.duggirala@oracle.com>2015-03-13 12:32:44 +0530
commit151b8ec4d11abbb3bf1fb55e10df3e3e7449fe1c (patch)
tree79ba2aea73b1e298afaef5cd7578f420b0b5eabb /sql/sql_table.cc
parent96974ea7ca2539e342d5e732a80e919a59f1d162 (diff)
downloadmariadb-git-151b8ec4d11abbb3bf1fb55e10df3e3e7449fe1c.tar.gz
Bug #20439913 CREATE TABLE DB.TABLE LIKE TMPTABLE IS BINLOGGED INCORRECTLY - BREAKS A SLAVE
Analysis: In row based replication, Master does not send temp table information to Slave. If there are any DDLs that involves in regular table that needs to be sent to Slave and a temp tables (which will not be available at Slave), the Master rewrites the query replacing temp table with it's defintion. Eg: create table regular_table like temptable. In rewrite logic, server is ignoring the database of regular table which can cause problems mentioned in this bug. Fix: dont ignore database information (if available) while rewriting the query
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 096e3d6be0f..b0547a16050 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4720,7 +4720,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
int result __attribute__((unused))=
store_create_info(thd, table, &query,
- create_info, FALSE /* show_database */);
+ create_info,
+ table->db ? TRUE : FALSE/* show_database */);
DBUG_ASSERT(result == 0); // store_create_info() always return 0
if (write_bin_log(thd, TRUE, query.ptr(), query.length()))