summaryrefslogtreecommitdiff
path: root/mysql-test/main/merge_innodb.test
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2018-03-09 14:05:35 +0200
committerMonty <monty@mariadb.org>2018-03-29 13:59:44 +0300
commita7abddeffa6a760ce948c2dfb007cdf3f1a369d5 (patch)
tree70eb743fa965a17380bbc0ac88ae79ca1075b896 /mysql-test/main/merge_innodb.test
parentab1941266c59a19703a74b5593cf3f508a5752d7 (diff)
downloadmariadb-git-a7abddeffa6a760ce948c2dfb007cdf3f1a369d5.tar.gz
Create 'main' test directory and move 't' and 'r' there
Diffstat (limited to 'mysql-test/main/merge_innodb.test')
-rw-r--r--mysql-test/main/merge_innodb.test72
1 files changed, 72 insertions, 0 deletions
diff --git a/mysql-test/main/merge_innodb.test b/mysql-test/main/merge_innodb.test
new file mode 100644
index 00000000000..9f87f241d00
--- /dev/null
+++ b/mysql-test/main/merge_innodb.test
@@ -0,0 +1,72 @@
+# t/merge_innodb.test
+#
+# Tests with MERGE tables over InnoDB tables
+#
+
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+--enable_warnings
+
+#
+# Bug#30491 - MERGE doesn't report error when one table is Innodb
+#
+CREATE TABLE t1 (c1 varchar(100)) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 varchar(100)) ENGINE=MyISAM;
+CREATE TABLE t3 (c1 varchar(100)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('Ann'), ('Alice');
+INSERT INTO t2 VALUES ('Bob'), ('Brian');
+INSERT INTO t3 VALUES ('Chris'), ('Charlie');
+CREATE TABLE t4 (c1 varchar(100)) ENGINE=MRG_MYISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TABLE t5 (c1 varchar(100)) ENGINE=MRG_MYISAM UNION=(t1,t3)
+ INSERT_METHOD=LAST;
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM t5;
+SELECT * FROM t4;
+ALTER TABLE t2 ENGINE=InnoDB;
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM t4;
+DELETE FROM t2 LIMIT 1;
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM t4;
+--error ER_WRONG_MRG_TABLE
+INSERT INTO t4 VALUES ('Beware');
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM t4;
+SELECT * FROM t2;
+SELECT * FROM t1;
+DROP TABLE t1, t2, t3, t4, t5;
+
+#
+# Bug#20691429 temporary merge over view under lock tables
+#
+create table t1 (c1 varchar(100));
+create table t2 (c1 varchar(100));
+create view t3 as select * from t1;
+insert into t1 values ('ann'), ('alice');
+insert into t2 values ('bob'), ('brian');
+create temporary table t4 (c1 varchar(100)) engine=MERGE union=(t2, t1);
+create temporary table t5 (c1 varchar(100)) engine=MERGE union=(t3, t1);
+--error ER_WRONG_MRG_TABLE
+select * from t5;
+lock tables t1 read, t2 read, t3 read, t4 read;
+--error ER_WRONG_MRG_TABLE
+select * from t5;
+select * from t4;
+unlock tables;
+drop table t2;
+create view t2 as select * from t1;
+--error ER_WRONG_MRG_TABLE
+select * from t4;
+lock tables t1 read, t2 read, t3 read;
+--error ER_WRONG_MRG_TABLE
+select * from t4;
+--error ER_WRONG_MRG_TABLE
+select * from t4;
+--error ER_WRONG_MRG_TABLE
+select * from t4;
+unlock tables;
+drop view t2, t3;
+drop table t1;