summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2016-04-29 16:50:58 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2016-04-29 16:50:58 -0400
commit8a1efa1bdd29b756c93a3ddbd8ad6fadec1082bc (patch)
tree9827e75d29817f3ddbc2008ba2b5b21553c14c5e /sql/sql_table.cc
parent7c42b47e67918104fddd121a1ca9fede28ed47cf (diff)
parent9eba34f08675c31b0796eeb127582be827773070 (diff)
downloadmariadb-git-8a1efa1bdd29b756c93a3ddbd8ad6fadec1082bc.tar.gz
Merge branch '10.0' into 10.0-galera
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f19b4e4cb8d..00d1155f923 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
@@ -5477,6 +5477,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
/*
We have to write the query before we unlock the tables.
*/
+ if (thd->is_current_stmt_binlog_disabled())
+ goto err;
+
if (thd->is_current_stmt_binlog_format_row())
{
/*
@@ -5547,6 +5550,21 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
*/
if (!table->view)
{
+ /*
+ 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))=
show_create_table(thd, table, &query, create_info, WITH_DB_NAME);
@@ -8519,7 +8537,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
till this point for the alter operation.
*/
if ((alter_info->flags & Alter_info::ADD_FOREIGN_KEY) &&
- check_fk_parent_table_access(thd, create_info, alter_info))
+ check_fk_parent_table_access(thd, create_info, alter_info, new_db))
DBUG_RETURN(true);
/*