diff options
-rw-r--r-- | mysql-test/r/alter_table.result | 8 | ||||
-rw-r--r-- | mysql-test/t/alter_table.test | 8 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 5a2b48219af..f0539559dc7 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1899,3 +1899,11 @@ alter table t1 add key if not exists (i); Warnings: Note 1061 Duplicate key name 'i' DROP TABLE t1; +create table t1 (a int); +alter table t1 change column if exists a b bigint; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index b0b017f2b70..247a79e2bda 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1643,3 +1643,11 @@ alter table t1 add key (i); alter table t1 add key if not exists (i); DROP TABLE t1; +# +# MDEV-4436 CHANGE COLUMN IF EXISTS does not work and throws wrong warning. +# +create table t1 (a int); +alter table t1 change column if exists a b bigint; +show create table t1; +DROP TABLE t1; + diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 97d33055455..ce4839fc580 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5309,7 +5309,7 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info) for (f_ptr=table->field; *f_ptr; f_ptr++) { if (my_strcasecmp(system_charset_info, - sql_field->field_name, (*f_ptr)->field_name) == 0) + sql_field->change, (*f_ptr)->field_name) == 0) { break; } |