summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorAditya A <aditya.a@oracle.com>2015-09-22 16:52:18 +0530
committerAditya A <aditya.a@oracle.com>2015-09-22 16:52:18 +0530
commitea9dbef661efdf5079b1b0e33679a863408e3166 (patch)
tree31fdc2fdd1a777fae629dc78a1a72e3a615eb9d6 /sql/sql_table.cc
parent86375f7fa6a428bfc405f85335685cd1dff25302 (diff)
downloadmariadb-git-ea9dbef661efdf5079b1b0e33679a863408e3166.tar.gz
Bug#20755615 CREATING INDEX ON A RENAMED COLUMN WITH CASE CRASH .FRM
FILE PROBLEM In 5.5 when doing doing a rename of a column ,we ignore the case between old and new column names while comparing them,so if the change is just the case then we don't even mark the field FIELD_IS_RENAMED ,we just update the frm file ,but don't recreate the table as is the norm when alter is used.This leads to inconsistency in the innodb data dictionary which causes index creation to fail. FIX According to the documentation any innodb column rename should trigger rebuild of the table. Therefore for innodb tables we will do a strcmp() between the column names and if there is case change in column name we will trigger a rebuild.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 2951d921e15..0a58d9ade5b 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -5048,10 +5048,22 @@ mysql_compare_tables(TABLE *table,
/* Check if field was renamed */
field->flags&= ~FIELD_IS_RENAMED;
- if (my_strcasecmp(system_charset_info,
- field->field_name,
- tmp_new_field->field_name))
- field->flags|= FIELD_IS_RENAMED;
+
+ /*
+ InnoDB data dictionary is case sensitive so we should use string case
+ sensitive comparison between fields. Note: strcmp branch is to be
+ removed in future when we fix it in InnoDB.
+ */
+ if ((table->s->db_type())->db_type == DB_TYPE_INNODB &&
+ strcmp(field->field_name,tmp_new_field->field_name))
+ field->flags|= FIELD_IS_RENAMED;
+ else
+ {
+ if (my_strcasecmp(system_charset_info,
+ field->field_name,
+ tmp_new_field->field_name))
+ field->flags|= FIELD_IS_RENAMED;
+ }
/* Evaluate changes bitmap and send to check_if_incompatible_data() */
if (!(tmp= field->is_equal(tmp_new_field)))