diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index c88abd9867e..2455bc4f997 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1925,8 +1925,8 @@ ALTER TABLE ti1 FORCE; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE tm1 FORCE; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 ALTER TABLE ti1 AUTO_INCREMENT 3; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 diff --git a/mysql-test/r/partition_alter.result b/mysql-test/r/partition_alter.result index 76b55cefb07..bc2c2f17c97 100644 --- a/mysql-test/r/partition_alter.result +++ b/mysql-test/r/partition_alter.result @@ -83,6 +83,8 @@ partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); alter table t1 add check (b in (0, 1)); +ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary` +alter table t1 add check (b in (0, 10)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -90,7 +92,7 @@ t1 CREATE TABLE `t1` ( `d` date NOT NULL, `b` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`,`d`), - CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,1)) + CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM, diff --git a/mysql-test/t/partition_alter.test b/mysql-test/t/partition_alter.test index 9194e9a8222..e320efcefb9 100644 --- a/mysql-test/t/partition_alter.test +++ b/mysql-test/t/partition_alter.test @@ -96,8 +96,10 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); -# FIXME: MDEV-12923 MyISAM allows CHECK constraint violation in ALTER TABLE +--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ +--error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); +alter table t1 add check (b in (0, 10)); show create table t1; --error ER_CONSTRAINT_FAILED insert t1 values (2, '2020-01-03', 20); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 77d098cd9f1..28c60308ce9 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -2291,16 +2291,19 @@ ha_myisam::check_if_supported_inplace_alter(TABLE *new_table, { DBUG_ENTER("ha_myisam::check_if_supported_inplace_alter"); - const uint readd_index= Alter_inplace_info::ADD_INDEX | + const Alter_inplace_info::HA_ALTER_FLAGS readd_index= + Alter_inplace_info::ADD_INDEX | Alter_inplace_info::DROP_INDEX; - const uint readd_unique= Alter_inplace_info::ADD_UNIQUE_INDEX | - Alter_inplace_info::DROP_UNIQUE_INDEX; - const uint readd_pk= Alter_inplace_info::ADD_PK_INDEX | - Alter_inplace_info::DROP_PK_INDEX; + const Alter_inplace_info::HA_ALTER_FLAGS readd_unique= + Alter_inplace_info::ADD_UNIQUE_INDEX | + Alter_inplace_info::DROP_UNIQUE_INDEX; + const Alter_inplace_info::HA_ALTER_FLAGS readd_pk= + Alter_inplace_info::ADD_PK_INDEX | + Alter_inplace_info::DROP_PK_INDEX; - const uint op= alter_info->handler_flags; + const Alter_inplace_info::HA_ALTER_FLAGS op= alter_info->handler_flags; - if (alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_VCOL) + if (op & Alter_inplace_info::ALTER_COLUMN_VCOL) DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); /*