From c03341a0a62d361fba3ed0c0c708d5a69bcd2668 Mon Sep 17 00:00:00 2001 From: vdimov Date: Thu, 8 Apr 2010 14:05:17 +0000 Subject: [PATCH] branches/zip: Adjust the innodb test after change in behavior in MySQL The change in behavior was introduced by this changeset: ------------------------------------------------------------ revno: 3405 revision-id: joro@sun.com-20100317141846-es0qyf5zcqb0hu1c parent: davi.arnaut@sun.com-20100309125156-z2c4uyqque49v61k committer: Georgi Kodinov branch nick: B49838-5.1-bugteam timestamp: Wed 2010-03-17 16:18:46 +0200 message: Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may corrupt definition at engine If a single ALTER TABLE contains both DROP INDEX and ADD INDEX using the same index name (a.k.a. index modification) we need to disable in-place alter table because we can't ask the storage engine to have two copies of the index with the same name even temporarily (if we first do the ADD INDEX and then DROP INDEX) and we can't modify indexes that are needed by e.g. foreign keys if we first do DROP INDEX and then ADD INDEX. Fixed the problem by disabling in-place ALTER TABLE for these cases. modified: mysql-test/r/innodb_mysql.result sp1f-innodb_mysql.result-20060426055153-bychbbfnqtvmvrwccwhn24i6yi46uqjv mysql-test/t/innodb_mysql.test sp1f-innodb_mysql.test-20060816102624-6ymo37d3nyhvbqyzqn5ohsfuydwo426k sql/sql_table.cc sp1f-sql_table.cc-19700101030959-tzdkvgigezpuaxnldqh3fx2h7h2ggslu --- mysql-test/innodb.result | 3 +-- mysql-test/innodb.test | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/innodb.result b/mysql-test/innodb.result index d7f4731436b..e435c0f68ca 100644 --- a/mysql-test/innodb.result +++ b/mysql-test/innodb.result @@ -692,7 +692,6 @@ select count(*) from t1 where sca_pic is null; count(*) 2 alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); -ERROR 42000: Incorrect index name 'sca_pic' alter table t1 drop index sca_pic; alter table t1 add index sca_pic (cat_code, sca_pic); select count(*) from t1 where sca_code='PD' and sca_pic is null; @@ -1753,7 +1752,7 @@ variable_value - @innodb_rows_deleted_orig 71 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; variable_value - @innodb_rows_inserted_orig -1084 +1087 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; variable_value - @innodb_rows_updated_orig 885 diff --git a/mysql-test/innodb.test b/mysql-test/innodb.test index 9f9766acd82..d3a795b3a9f 100644 --- a/mysql-test/innodb.test +++ b/mysql-test/innodb.test @@ -428,7 +428,9 @@ select count(*) from t1 where sca_code = 'PD'; select count(*) from t1 where sca_code <= 'PD'; select count(*) from t1 where sca_pic is null; # this should be fixed by MySQL (see Bug #51451) ---error ER_WRONG_NAME_FOR_INDEX +# now that http://bugs.mysql.com/49838 is fixed the following ALTER does +# copy the table instead of failing +# --error ER_WRONG_NAME_FOR_INDEX alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); alter table t1 drop index sca_pic; alter table t1 add index sca_pic (cat_code, sca_pic);