summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-12-29 13:23:18 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-29 13:23:18 +0100
commit4a5d25c338a5d1d2cc16343380193d6bf25ae6ae (patch)
tree73b84a9c8f3d5e3e3383fa79465b11f9ded512d3 /sql/sql_admin.cc
parent48dc7cc66ef5b69fcf28ec0b2ecf0338c188cf4e (diff)
parentc13b5011629b5ff7b969d648265002e4d1ba94c2 (diff)
downloadmariadb-git-4a5d25c338a5d1d2cc16343380193d6bf25ae6ae.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r--sql/sql_admin.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index ed23d9cccd6..bc5b9bde8e8 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -380,7 +380,19 @@ static bool open_only_one_table(THD* thd, TABLE_LIST* table,
}
thd->prepare_derived_at_open= FALSE;
- table->next_global= save_next_global;
+ /*
+ MERGE engine may adjust table->next_global chain, thus we have to
+ append save_next_global after merge children.
+ */
+ if (save_next_global)
+ {
+ TABLE_LIST *table_list_iterator= table;
+ while (table_list_iterator->next_global)
+ table_list_iterator= table_list_iterator->next_global;
+ table_list_iterator->next_global= save_next_global;
+ save_next_global->prev_global= &table_list_iterator->next_global;
+ }
+
table->next_local= save_next_local;
return open_error;