diff options
Diffstat (limited to 'mysql-test/t/merge.test')
-rw-r--r-- | mysql-test/t/merge.test | 85 |
1 files changed, 82 insertions, 3 deletions
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 9d0ddd01752..311eb6f12f3 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -655,7 +655,7 @@ insert into t1 values (1); flush tables; # Open t2 and (implicitly) t1. select * from t2; -# Truncate t1, wich was not recognized as open without the bugfix. +# Truncate t1, which was not recognized as open without the bugfix. # After fix for Bug#8306 and before fix for Bug#26379, # it should fail with a table-in-use error message, otherwise succeed. truncate table t1; @@ -1559,7 +1559,7 @@ CREATE TABLE m1 ( ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(t1); insert into m1 (col1) values (1); ---error ER_DUP_ENTRY +--error ER_DUP_KEY insert into m1 (col1) values (1); drop table m1, t1; @@ -1593,7 +1593,7 @@ CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1), UNIQUE (c2)); CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c1)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1); INSERT INTO m1 VALUES (1,2); --echo # insert the duplicate value into the merge table ---error ER_DUP_ENTRY +--error ER_DUP_KEY INSERT INTO m1 VALUES (3,2); DROP TABLE m1,t1; @@ -2895,6 +2895,85 @@ DROP TABLE t1, tmerge; --echo End of 5.5 tests + +--echo # +--echo # Additional coverage for refactoring which is made as part +--echo # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege +--echo # to allow temp table operations". +--echo # +--echo # Check that prelocking works correctly for various variants of +--echo # merge tables. +--disable_warnings +drop table if exists t1, t2, m1; +drop function if exists f1; +--enable_warnings +create table t1 (j int); +insert into t1 values (1); +create function f1() returns int return (select count(*) from m1); +create temporary table t2 (a int) engine=myisam; +insert into t2 values (1); +create temporary table m1 (a int) engine=merge union=(t2); +select f1() from t1; +drop tables t2, m1; +create table t2 (a int) engine=myisam; +insert into t2 values (1); +create table m1 (a int) engine=merge union=(t2); +select f1() from t1; +drop table m1; +create temporary table m1 (a int) engine=merge union=(t2); +select f1() from t1; +drop tables t1, t2, m1; +drop function f1; +--echo # +--echo # Check that REPAIR/CHECK and CHECKSUM statements work correctly +--echo # for various variants of merge tables. +create table t1 (a int) engine=myisam; +insert into t1 values (1); +create table m1 (a int) engine=merge union=(t1); +check table m1; +repair table m1; +checksum table m1; +drop tables t1, m1; +create temporary table t1 (a int) engine=myisam; +insert into t1 values (1); +create temporary table m1 (a int) engine=merge union=(t1); +check table m1; +repair table m1; +checksum table m1; +drop tables t1, m1; +create table t1 (a int) engine=myisam; +insert into t1 values (1); +create temporary table m1 (a int) engine=merge union=(t1); +check table m1; +repair table m1; +checksum table m1; +drop tables t1, m1; + +# Check effect of Bug#27480-preliminary patch: +# a merge-table with non-existing children, opened from a prelocked list. + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS m1; +DROP TRIGGER IF EXISTS trg1; +DROP TABLE IF EXISTS q1; +DROP TABLE IF EXISTS q2; +--enable_warnings + +CREATE TABLE t1(a INT); +CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2); + +CREATE TRIGGER trg1 BEFORE DELETE ON t1 +FOR EACH ROW + INSERT INTO m1 VALUES (1); + +--error ER_WRONG_MRG_TABLE +DELETE FROM t1; + +DROP TRIGGER trg1; +DROP TABLE t1; +DROP TABLE m1; + --disable_result_log --disable_query_log eval set global storage_engine=$default; |