1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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.
This commit is contained in:
Aditya A
2015-09-22 16:52:18 +05:30
parent 86375f7fa6
commit ea9dbef661
3 changed files with 52 additions and 4 deletions

View File

@@ -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)))