summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <acurtis@xiphis.org>2006-05-09 13:31:46 -0700
committerunknown <acurtis@xiphis.org>2006-05-09 13:31:46 -0700
commit7900e2366f76166cfa08daaed143e0c2babfd07b (patch)
tree1fed1caed61ab2e91c6c91ac94cad060494a7492 /sql/sql_table.cc
parent9bf3234c6a4cc2c4f767a670d90dd1b42ef4d998 (diff)
downloadmariadb-git-7900e2366f76166cfa08daaed143e0c2babfd07b.tar.gz
bug#10952
"alter table from MyISAM to MERGE lost data without errors and warnings" Add new handlerton flag which prevent user from altering table storage engine to storage engines which would lose data. Both 'blackhole' and 'merge' are marked with the new flag. Tests included. mysql-test/r/blackhole.result: test for bug#10952 mysql-test/r/merge.result: test for bug#10952 mysql-test/t/blackhole.test: test for bug#10952 mysql-test/t/merge.test: test for bug#10952 sql/ha_blackhole.cc: Bug#10952 shouldn't be able to alter a table into a blackhole sql/ha_myisammrg.cc: Bug#10952 shouldn't be able to alter a table into a merge sql/handler.h: Bug#10952 new handlerton flag sql/sql_table.cc: Bug#10952 If alter is changing engine, check if new engine allows creating table via ALTER statement.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 7b739798b38..805c7c1edc0 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3313,7 +3313,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);