From 04af59a36c1a18d153a224970732acd6f8f525c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Aug 2005 21:00:43 +0200 Subject: [PATCH] fix for bug 12207 (alter table discard tablespace on MyISAM table causes ERROR 2013). (all-in-one approved patch) mysql-test/r/alter_table.result: result for test for bug #12207 (alter table discard database works on mysiam and causes error 2013) mysql-test/t/alter_table.test: test for bug #12207 (alter table discard tablescpae on MyISAM table causes ERROR 2013) sql/sql_table.cc: send all error message to table->file->print_error() thus not missing handing of some (like engine not supported). fix for bug #12207 (alter table discard tablespace on MyISAM table causes ERROR 2013) --- mysql-test/r/alter_table.result | 4 ++++ mysql-test/t/alter_table.test | 8 ++++++++ sql/sql_table.cc | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 9f127181fc2..dd7c5ed4407 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -523,6 +523,10 @@ alter table t1 drop key no_such_key; ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists alter table t1 drop key a; drop table t1; +CREATE TABLE T12207(a int) ENGINE=MYISAM; +ALTER TABLE T12207 DISCARD TABLESPACE; +ERROR HY000: Table storage engine for 'T12207' doesn't have this option +DROP TABLE T12207; create table t1 (a text) character set koi8r; insert into t1 values (_koi8r'ΤΕΣΤ'); select hex(a) from t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index a237b21f403..003662fc956 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -337,6 +337,14 @@ alter table t1 drop key no_such_key; alter table t1 drop key a; drop table t1; +# +# BUG 12207 alter table ... discard table space on MyISAM table causes ERROR 2013 (HY000) +# +CREATE TABLE T12207(a int) ENGINE=MYISAM; +--error 1031 +ALTER TABLE T12207 DISCARD TABLESPACE; +DROP TABLE T12207; + # # Bug #6479 ALTER TABLE ... changing charset fails for TEXT columns # diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8874a70327e..d7609bc2f58 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2820,15 +2820,15 @@ mysql_discard_or_import_tablespace(THD *thd, err: close_thread_tables(thd); thd->tablespace_op=FALSE; + if (error == 0) { send_ok(thd); DBUG_RETURN(0); } - if (error == HA_ERR_ROW_IS_REFERENCED) - my_error(ER_ROW_IS_REFERENCED, MYF(0)); - + table->file->print_error(error, MYF(0)); + DBUG_RETURN(-1); }