diff options
author | svoj@april.(none) <> | 2006-05-24 15:13:49 +0500 |
---|---|---|
committer | svoj@april.(none) <> | 2006-05-24 15:13:49 +0500 |
commit | 0674c702b0c082064c0598ac96f6c53c8e209645 (patch) | |
tree | fd0eccf58ba87450abc126a3df4e5ff4434da527 | |
parent | fb27799a869a97b9d503fe8f8a075b45d697360c (diff) | |
parent | 3afbfc5fedeb939a49cfd629a16094d54a8e1ad4 (diff) | |
download | mariadb-git-0674c702b0c082064c0598ac96f6c53c8e209645.tar.gz |
Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.0
into april.(none):/home/svoj/devel/mysql/BUG17001/mysql-5.0
-rw-r--r-- | sql/sql_table.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 32a86b0f39a..476d5536581 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3140,7 +3140,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, uint db_create_options, used_fields; enum db_type old_db_type,new_db_type; bool need_copy_table; - bool no_table_reopen= FALSE; + bool no_table_reopen= FALSE, varchar= FALSE; DBUG_ENTER("mysql_alter_table"); thd->proc_info="init"; @@ -3344,6 +3344,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, Field **f_ptr,*field; for (f_ptr=table->field ; (field= *f_ptr) ; f_ptr++) { + if (field->type() == MYSQL_TYPE_STRING) + varchar= TRUE; /* Check if field should be dropped */ Alter_drop *drop; drop_it.rewind(); @@ -3605,12 +3607,18 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, better have a negative test here, instead of positive, like alter_info->flags & ALTER_ADD_COLUMN|ALTER_ADD_INDEX|... so that ALTER TABLE won't break when somebody will add new flag + + MySQL uses frm version to determine the type of the data fields and + their layout. See Field_string::type() for details. + Thus, if the table is too old we may have to rebuild the data to + update the layout. */ need_copy_table= (alter_info->flags & ~(ALTER_CHANGE_COLUMN_DEFAULT|ALTER_OPTIONS) || (create_info->used_fields & ~(HA_CREATE_USED_COMMENT|HA_CREATE_USED_PASSWORD)) || - table->s->tmp_table); + table->s->tmp_table || + (table->s->frm_version < FRM_VER_TRUE_VARCHAR && varchar)); create_info->frm_only= !need_copy_table; /* |