summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index ce4839fc580..a6bfcc2bbd0 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -6752,7 +6752,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
List<Key_part_spec> key_parts;
uint db_create_options= (table->s->db_create_options
& ~(HA_OPTION_PACK_RECORD));
- uint used_fields= create_info->used_fields;
+ uint used_fields;
KEY *key_info=table->key_info;
bool rc= TRUE;
bool modified_primary_key= FALSE;
@@ -6760,6 +6760,14 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
Field **f_ptr,*field;
DBUG_ENTER("mysql_prepare_alter_table");
+ /*
+ Merge incompatible changes flag in case of upgrade of a table from an
+ old MariaDB or MySQL version. This ensures that we don't try to do an
+ online alter table if field packing or character set changes are required.
+ */
+ create_info->used_fields|= table->s->incompatible_version;
+ used_fields= create_info->used_fields;
+
create_info->varchar= FALSE;
/* Let new create options override the old ones */
if (!(used_fields & HA_CREATE_USED_MIN_ROWS))
@@ -7744,8 +7752,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DEBUG_SYNC(thd, "alter_table_before_open_tables");
uint tables_opened;
+
+ thd->open_options|= HA_OPEN_FOR_ALTER;
bool error= open_tables(thd, &table_list, &tables_opened, 0,
&alter_prelocking_strategy);
+ thd->open_options&= ~HA_OPEN_FOR_ALTER;
DEBUG_SYNC(thd, "alter_opened_table");