summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-12-16 20:51:48 +0200
committerMichael Widenius <monty@askmonty.org>2012-12-16 20:51:48 +0200
commita334e87d6569f71324a10e104074668fc483c520 (patch)
tree5c311da6b284615182bd3067b97280492bab9115
parentb31909ffbb967b147b9570af4ff7d03de6d5912c (diff)
downloadmariadb-git-a334e87d6569f71324a10e104074668fc483c520.tar.gz
Remember original table row pack type for ALTER TABLE if table is not copied.
-rw-r--r--sql/sql_table.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 868e1215595..5ab00f34c97 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4124,7 +4124,8 @@ bool mysql_create_table_no_lock(THD *thd,
set_table_default_charset(thd, create_info, (char*) db);
db_options= create_info->table_options;
- if (create_info->row_type != ROW_TYPE_FIXED &&
+ if (!create_info->frm_only &&
+ create_info->row_type != ROW_TYPE_FIXED &&
create_info->row_type != ROW_TYPE_DEFAULT)
db_options|= HA_OPTION_PACK_RECORD;
alias= table_case_name(create_info, table_name);
@@ -6670,9 +6671,19 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
my_sleep(100000););
/*
Create a table with a temporary name.
- With create_info->frm_only == 1 this creates a .frm file only.
+ With create_info->frm_only == 1 this creates a .frm file only and
+ we keep the original row format.
We don't log the statement, it will be logged later.
*/
+ if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
+ {
+ DBUG_ASSERT(create_info->frm_only);
+ /* Ensure we keep the original table format */
+ create_info->table_options= ((create_info->table_options &
+ ~HA_OPTION_PACK_RECORD) |
+ (table->s->db_create_options &
+ HA_OPTION_PACK_RECORD));
+ }
tmp_disable_binlog(thd);
error= mysql_create_table_no_lock(thd, new_db, tmp_name,
create_info,