Commit 06a91b18 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-4436 CHANGE COLUMN IF EXISTS does not work and throws wrong warning.

        Use sql_field->change parameter as the name of the field.
parent 3cf7e283
......@@ -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;
......@@ -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;
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment