diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-11-29 20:21:05 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-11-29 20:21:05 +0100 |
commit | f534708bd6637da06a0dbeb5192351072a8bbbcd (patch) | |
tree | 7df07e29a2c712c5012c461b711dd446c4765446 /storage/myisammrg | |
parent | 0657f102afe0a683c6ef9e330828af977dd5433c (diff) | |
download | mariadb-git-f534708bd6637da06a0dbeb5192351072a8bbbcd.tar.gz |
MDEV-5266 MySQL:57657 - Temporary MERGE table with temporary underlying is broken by ALTER
Fix ha_myisammrg::update_create_info() to do what ha_myisammrg::append_create_info() does -
take sub-table names from TABLE_LIST, not reverse engineer tablefile names.
Backport praveenkumar.hulakund@oracle.com-20120127081643-u7dxy23i8yyqarm7 from mysql-5.6
Diffstat (limited to 'storage/myisammrg')
-rw-r--r-- | storage/myisammrg/ha_myisammrg.cc | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 28e2a87e3c5..99ee81d2438 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -1111,31 +1111,36 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info) if (!(create_info->used_fields & HA_CREATE_USED_UNION)) { - MYRG_TABLE *open_table; + TABLE_LIST *child_table; THD *thd=current_thd; create_info->merge_list.next= &create_info->merge_list.first; create_info->merge_list.elements=0; - for (open_table=file->open_tables ; - open_table != file->end_table ; - open_table++) + if (table->child_l != NULL) { - TABLE_LIST *ptr; - LEX_STRING db, name; - LINT_INIT(db.str); - - if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST)))) - goto err; - split_file_name(open_table->table->filename, &db, &name); - if (!(ptr->table_name= thd->strmake(name.str, name.length))) - goto err; - if (db.length && !(ptr->db= thd->strmake(db.str, db.length))) - goto err; - - create_info->merge_list.elements++; - (*create_info->merge_list.next) = ptr; - create_info->merge_list.next= &ptr->next_local; + for (child_table= table->child_l;; + child_table= child_table->next_global) + { + TABLE_LIST *ptr; + + if (!(ptr= (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST)))) + goto err; + + if (!(ptr->table_name= thd->strmake(child_table->table_name, + child_table->table_name_length))) + goto err; + if (child_table->db && !(ptr->db= thd->strmake(child_table->db, + child_table->db_length))) + goto err; + + create_info->merge_list.elements++; + (*create_info->merge_list.next)= ptr; + create_info->merge_list.next= &ptr->next_local; + + if (&child_table->next_global == table->child_last_l) + break; + } } *create_info->merge_list.next=0; } |