diff options
Diffstat (limited to 'mysql-test/main/alter_table.test')
-rw-r--r-- | mysql-test/main/alter_table.test | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index e65a4edf13e..1bff20a7bd7 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -2100,6 +2100,47 @@ drop table t1; drop view v1; --echo # +--echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +--echo # +set @save_default_engine= @@default_storage_engine; +--disable_query_log +if ($MTR_COMBINATION_INNODB) +{ + set default_storage_engine= innodb; +} +if ($MTR_COMBINATION_ARIA) +{ + set default_storage_engine= aria; +} +--enable_query_log + +if (!$MTR_COMBINATION_INNODB) +{ + --disable_query_log + --disable_result_log + # There is no inplace ADD INDEX for MyISAM/Aria: + create or replace table t1 (x int); + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add unique (x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add primary key(x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add index(x), algorithm=inplace; + --enable_query_log + --enable_result_log +} + +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +# cleanup +drop table t1; +set @@default_storage_engine= @save_default_engine; + +--echo # --echo # End of 10.3 tests --echo # @@ -2568,5 +2609,58 @@ show create table t1; drop table t1; --echo # +--echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +--echo # +set @save_default_engine= @@default_storage_engine; +--disable_query_log +if ($MTR_COMBINATION_INNODB) +{ + set default_storage_engine= innodb; +} +if ($MTR_COMBINATION_ARIA) +{ + set default_storage_engine= aria; +} +--enable_query_log + +if (!$MTR_COMBINATION_INNODB) +{ + --disable_query_log + --disable_result_log + # There is no inplace ADD INDEX for MyISAM/Aria: + create or replace table t1 (x int); + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add unique (x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add primary key(x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add index(x), algorithm=inplace; + --enable_query_log + --enable_result_log +} + +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +# cleanup +drop table t1; +set @@default_storage_engine= @save_default_engine; + +--echo # +--echo # MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table +--echo # +create table t1 (a int, key idx1(a), key idx2 using btree(a)) engine=memory; +alter table t1 rename index idx1 to idx3, algorithm=inplace; +delete from t1 where a = 10; +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t1 drop key idx3, add key idx1(a), algorithm=inplace; +delete from t1 where a = 11; +# cleanup +drop table t1; + +--echo # --echo # End of 10.5 tests --echo # |