diff options
-rw-r--r-- | mysql-test/r/merge.result | 6 | ||||
-rw-r--r-- | mysql-test/r/partition_error.result | 24 | ||||
-rw-r--r-- | mysql-test/t/lock_multi.test | 3 | ||||
-rw-r--r-- | mysql-test/t/merge.test | 9 | ||||
-rw-r--r-- | mysql-test/t/partition_error.test | 20 | ||||
-rw-r--r-- | sql/ha_myisammrg.h | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 17 |
7 files changed, 78 insertions, 3 deletions
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 2f5f382028a..38ade38747e 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -779,3 +779,9 @@ 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; +create table t1 (b bit(1)); +create table t2 (b bit(1)); +create table tm (b bit(1)) engine = merge union = (t1,t2); +select * from tm; +b +drop table tm, t1, t2; diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 0ab65f669ac..39f0cf9ca55 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1,4 +1,28 @@ drop table if exists t1; +create table t1 (a int) +engine = x +partition by key (a); +Warnings: +Error 1286 Unknown table engine 'x' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) +drop table t1; +create table t1 (a int) +engine = innodb +partition by list (a) +(partition p0 values in (0)); +alter table t1 engine = x; +Warnings: +Error 1286 Unknown table engine 'x' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) +drop table t1; partition by list (a) partitions 3 (partition x1 values in (1,2,9,4) tablespace ts1, diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index d0577d6f2f3..6ebcf595645 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -157,7 +157,7 @@ use test; # connection default; -# End of 5.0 tests +# # Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock # connect (con1,localhost,root,,); @@ -191,3 +191,4 @@ disconnect con2; --error ER_DB_DROP_EXISTS DROP DATABASE mysqltest_1; +# End of 5.0 tests diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 9fee4a03b81..c211ff2ac29 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -393,4 +393,13 @@ insert into t1 values ("Monty"),("WAX"),("Walrus"); alter table t1 engine=MERGE; drop table t1; +# +# BUG#19648 - Merge table does not work with bit types +# +create table t1 (b bit(1)); +create table t2 (b bit(1)); +create table tm (b bit(1)) engine = merge union = (t1,t2); +select * from tm; +drop table tm, t1, t2; + # End of 5.0 tests diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 19e43372670..076c5c5773b 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -9,6 +9,24 @@ drop table if exists t1; --enable_warnings # +# Bug 20397: Partitions: Crash when using non-existing engine +# +create table t1 (a int) +engine = x +partition by key (a); +show create table t1; +drop table t1; + +create table t1 (a int) +engine = innodb +partition by list (a) +(partition p0 values in (0)); + +alter table t1 engine = x; +show create table t1; +drop table t1; + +# # Partition by key stand-alone error # --error 1064 @@ -779,3 +797,5 @@ partition by range (a + (select count(*) from t1)) -- error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR create table t1 (a char(10)) partition by hash (extractvalue(a,'a')); + + diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index b67ec3dc204..d58a3523c26 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -38,7 +38,7 @@ class ha_myisammrg: public handler return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_NO_TRANSACTIONS | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED | HA_CAN_INSERT_DELAYED | HA_ANY_INDEX_MAY_BE_UNIQUE | - HA_NO_COPY_ON_ALTER); + HA_CAN_BIT_FIELD | HA_NO_COPY_ON_ALTER); } ulong index_flags(uint inx, uint part, bool all_parts) const { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 58a123d6602..d379af3b3eb 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5008,7 +5008,22 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, old_db_type= table->s->db_type; if (!create_info->db_type) - create_info->db_type= old_db_type; + { + if (table->part_info && + create_info->used_fields & HA_CREATE_USED_ENGINE) + { + /* + This case happens when the user specified + ENGINE = x where x is a non-existing storage engine + We set create_info->db_type to default_engine_type + to ensure we don't change underlying engine type + due to a erroneously given engine name. + */ + create_info->db_type= table->part_info->default_engine_type; + } + else + create_info->db_type= old_db_type; + } #ifdef WITH_PARTITION_STORAGE_ENGINE if (prep_alter_part_table(thd, table, alter_info, create_info, old_db_type, |