diff options
author | unknown <acurtis@xiphis.org> | 2006-05-09 15:12:32 -0700 |
---|---|---|
committer | unknown <acurtis@xiphis.org> | 2006-05-09 15:12:32 -0700 |
commit | dac69dd4a2179a4bfbfacb22b41969c015f07d2d (patch) | |
tree | 953c28f4c048afce6fe7878d962661cb0ea4f2ef | |
parent | d6c2616c3ff4f3035f140f1b2923186fc8ae3601 (diff) | |
parent | f61748b796c719bbd0a626a171bddef9f07392ff (diff) | |
download | mariadb-git-dac69dd4a2179a4bfbfacb22b41969c015f07d2d.tar.gz |
Merge xiphis.org:/home/antony/work2/p1-bug10952.1
into xiphis.org:/home/antony/work2/mysql-5.0-engines-merge
-rw-r--r-- | mysql-test/r/blackhole.result | 8 | ||||
-rw-r--r-- | mysql-test/r/merge.result | 8 | ||||
-rw-r--r-- | mysql-test/t/blackhole.test | 12 | ||||
-rw-r--r-- | mysql-test/t/merge.test | 12 | ||||
-rw-r--r-- | sql/ha_blackhole.cc | 2 | ||||
-rw-r--r-- | sql/ha_myisammrg.cc | 2 | ||||
-rw-r--r-- | sql/handler.h | 1 | ||||
-rw-r--r-- | sql/sql_table.cc | 4 |
8 files changed, 46 insertions, 3 deletions
diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result index 140d7e73d48..a4c057f256c 100644 --- a/mysql-test/r/blackhole.result +++ b/mysql-test/r/blackhole.result @@ -123,3 +123,11 @@ master-bin.000001 # Query 1 # use `test`; create table t3 like t1 master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3 master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3 drop table t1,t2,t3; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1 (c char(20)) engine=MyISAM; +insert into t1 values ("Monty"),("WAX"),("Walrus"); +alter table t1 engine=blackhole; +ERROR HY000: Table storage engine for 't1' doesn't have this option +drop table t1; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 58e1f86b3f9..9a34d6fba58 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -768,3 +768,11 @@ Table Op Msg_type Msg_text test.t1 check status OK test.t2 check status OK drop table t1, t2, t3; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1 (c char(20)) engine=MyISAM; +insert into t1 values ("Monty"),("WAX"),("Walrus"); +alter table t1 engine=MERGE; +ERROR HY000: Table storage engine for 't1' doesn't have this option +drop table t1; diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index e40b84eb5cd..493f74ded3e 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -128,3 +128,15 @@ show binlog events; drop table t1,t2,t3; # End of 4.1 tests + +# +# BUG#10952 - alter table ... lost data without errors and warnings +# +drop table if exists t1; +create table t1 (c char(20)) engine=MyISAM; +insert into t1 values ("Monty"),("WAX"),("Walrus"); +--error 1031 +alter table t1 engine=blackhole; +drop table t1; + +# End of 5.0 tests diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 060f1ea167b..7ea14a811ed 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -379,3 +379,15 @@ check table t1, t2; drop table t1, t2, t3; # End of 4.1 tests + +# +# BUG#10952 - alter table ... lost data without errors and warnings +# +drop table if exists t1; +create table t1 (c char(20)) engine=MyISAM; +insert into t1 values ("Monty"),("WAX"),("Walrus"); +--error 1031 +alter table t1 engine=MERGE; +drop table t1; + +# End of 5.0 tests diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index 2505919af39..7632ed59949 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -47,7 +47,7 @@ handlerton blackhole_hton= { NULL, /* create_cursor_read_view */ NULL, /* set_cursor_read_view */ NULL, /* close_cursor_read_view */ - HTON_CAN_RECREATE + HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE }; /***************************************************************************** diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 9780f163634..d2fd1a9e28a 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -55,7 +55,7 @@ handlerton myisammrg_hton= { NULL, /* create_cursor_read_view */ NULL, /* set_cursor_read_view */ NULL, /* close_cursor_read_view */ - HTON_CAN_RECREATE + HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE }; diff --git a/sql/handler.h b/sql/handler.h index eee15fc3576..31aac075a5e 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -409,6 +409,7 @@ struct show_table_alias_st { #define HTON_ALTER_NOT_SUPPORTED (1 << 1) //Engine does not support alter #define HTON_CAN_RECREATE (1 << 2) //Delete all is used fro truncate #define HTON_HIDDEN (1 << 3) //Engine does not appear in lists +#define HTON_ALTER_CANNOT_CREATE (1 << 4) //Cannot use alter to create typedef struct st_thd_trans { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index c9e9ce1bba7..9eaadc58cb0 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3324,7 +3324,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, DBUG_PRINT("info", ("old type: %d new type: %d", old_db_type, new_db_type)); if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED) || - ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED)) + ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED) || + (old_db_type != new_db_type && + ha_check_storage_engine_flag(new_db_type, HTON_ALTER_CANNOT_CREATE))) { DBUG_PRINT("info", ("doesn't support alter")); my_error(ER_ILLEGAL_HA, MYF(0), table_name); |