summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-04-20 15:25:55 +0200
committerSergei Golubchik <serg@mariadb.org>2016-04-20 15:25:55 +0200
commitb069d19284b70ead3ceb62618acdc8ef93a2703e (patch)
tree0d5f6764825d51db3b8a37c8043d837c06e3e086 /sql/sql_table.cc
parent1bc0b0b5245977172e2c3a3c64a42a2c4e762e06 (diff)
parente7061f7e5a96c66cb2e0bf46bec7f6ff35801a69 (diff)
downloadmariadb-git-b069d19284b70ead3ceb62618acdc8ef93a2703e.tar.gz
Merge branch 'mysql/5.5' into 5.5
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 274fedc7541..9d161ebc0de 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
This program is free software; you can redistribute it and/or modify
@@ -4880,7 +4880,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
/*
We have to write the query before we unlock the tables.
*/
- if (thd->is_current_stmt_binlog_format_row())
+ if (!thd->is_current_stmt_binlog_disabled() &&
+ thd->is_current_stmt_binlog_format_row())
{
/*
Since temporary tables are not replicated under row-based
@@ -4922,6 +4923,21 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
if (open_table(thd, table, thd->mem_root, &ot_ctx))
goto err;
+ /*
+ After opening a MERGE table add the children to the query list of
+ tables, so that children tables info can be used on "CREATE TABLE"
+ statement generation by the binary log.
+ Note that placeholders don't have the handler open.
+ */
+ if (table->table->file->extra(HA_EXTRA_ADD_CHILDREN_LIST))
+ goto err;
+
+ /*
+ As the reference table is temporary and may not exist on slave, we must
+ force the ENGINE to be present into CREATE TABLE.
+ */
+ create_info->used_fields|= HA_CREATE_USED_ENGINE;
+
int result __attribute__((unused))=
store_create_info(thd, table, &query,
create_info, TRUE /* show_database */);