1633
1635
DROP TRIGGER tr1;
1634
1636
DROP TABLE t1, t2, t3;
1639
--echo # BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40)
1641
CREATE DATABASE `test/1`;
1643
CREATE TABLE `test/1`.`t/1`(a INT);
1644
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
1646
SHOW CREATE TABLE m1;
1649
CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
1650
SELECT * FROM `test/1`.m1;
1651
SHOW CREATE TABLE `test/1`.m1;
1652
DROP TABLE `test/1`.m1;
1653
DROP TABLE `test/1`.`t/1`;
1655
CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT);
1656
CREATE TEMPORARY TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
1658
SHOW CREATE TABLE m1;
1661
CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
1662
SELECT * FROM `test/1`.m1;
1663
SHOW CREATE TABLE `test/1`.m1;
1664
DROP TABLE `test/1`.m1;
1665
DROP TABLE `test/1`.`t/1`;
1667
DROP DATABASE `test/1`;
1669
# Test compatibility. Use '@' instead of '/' (was not allowed in 5.0)
1671
CREATE TABLE `t@1`(a INT);
1672
copy_file std_data/bug48265.frm $MYSQLD_DATADIR/test/m1.frm;
1673
write_file $MYSQLD_DATADIR/test/m1.MRG;
1677
SHOW CREATE TABLE m1;
1680
CREATE DATABASE `test@1`;
1681
CREATE TABLE `test@1`.`t@1`(a INT);
1683
remove_file $MYSQLD_DATADIR/test/m1.MRG;
1684
write_file $MYSQLD_DATADIR/test/m1.MRG;
1688
SHOW CREATE TABLE m1;
1690
DROP TABLE `test@1`.`t@1`;
1691
DROP DATABASE `test@1`;
1694
--echo # Bug#51494c rash with join, explain and 'sounds like' operator
1697
CREATE TABLE t1 (a INT) ENGINE=MYISAM;
1698
INSERT INTO t1 VALUES(1);
1700
CREATE TABLE t2 (b INT NOT NULL,c INT,d INT,e BLOB NOT NULL,
1701
KEY idx0 (d, c)) ENGINE=MERGE;
1703
EXPLAIN SELECT * FROM t1 NATURAL RIGHT JOIN
1704
t2 WHERE b SOUNDS LIKE e AND d = 1;
1709
--echo # Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
1712
DROP TABLE IF EXISTS m1, t1;
1715
# Test derived from a proposal of Shane Bester.
1717
CREATE TABLE t1 (c1 INT) ENGINE=MYISAM;
1718
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST;
1720
# REPAIR ... USE_FRM with LOCK TABLES.
1723
REPAIR TABLE m1 USE_FRM;
1726
# REPAIR ... USE_FRM without LOCK TABLES.
1728
# This statement crashed the server (Bug#46339).
1730
REPAIR TABLE m1 USE_FRM;
1734
# Test derived from a proposal of Matthias Leich.
1736
# Base table is missing.
1738
CREATE TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1);
1740
# This statement crashed the server (Bug#46339).
1742
REPAIR TABLE m1 USE_FRM;
1744
# Create base table.
1746
CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM;
1748
# This statement crashed the server (Bug#46339).
1750
REPAIR TABLE m1 USE_FRM;
1752
# Normal repair as reference.
1760
# Same with temporary tables.
1762
# Base table is missing.
1764
CREATE TEMPORARY TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1);
1766
# This statement crashed the server (Bug#46339).
1768
REPAIR TABLE m1 USE_FRM;
1770
# Create base table.
1772
CREATE TEMPORARY TABLE t1 (f1 BIGINT) ENGINE=MyISAM;
1774
# This statement crashed the server (Bug#46339).
1776
REPAIR TABLE m1 USE_FRM;
1778
# Normal repair as reference.
1788
--echo # BUG#11763712 - 56458: KILLING A FLUSH TABLE FOR A MERGE/CHILD
1789
--echo # CRASHES SERVER
1791
CREATE TABLE t1(a INT);
1792
CREATE TABLE t2(a INT);
1793
CREATE TABLE t3(a INT, b INT);
1794
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
1796
--echo # Test reopen merge parent failure
1797
LOCK TABLES m1 READ;
1798
--echo # Remove 'm1' table using file operations.
1799
remove_file $MYSQLD_DATADIR/test/m1.MRG;
1800
remove_file $MYSQLD_DATADIR/test/m1.frm;
1801
--error ER_NO_SUCH_TABLE
1804
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
1806
--echo # Test reopen merge child failure
1807
LOCK TABLES m1 READ;
1808
--echo # Remove 't1' table using file operations.
1809
remove_file $MYSQLD_DATADIR/test/t1.frm;
1810
remove_file $MYSQLD_DATADIR/test/t1.MYI;
1811
remove_file $MYSQLD_DATADIR/test/t1.MYD;
1812
--error ER_NO_SUCH_TABLE
1815
CREATE TABLE t1(a INT);
1817
--echo # Test reattach merge failure
1818
LOCK TABLES m1 READ;
1819
--echo # Replace 't1' with 't3' table using file operations.
1820
# move + remove is a work around for windows.
1821
move_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/oldt1.frm;
1822
move_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/oldt1.MYI;
1823
move_file $MYSQLD_DATADIR/test/t1.MYD $MYSQLD_DATADIR/test/oldt1.MYD;
1824
remove_file $MYSQLD_DATADIR/test/oldt1.frm;
1825
remove_file $MYSQLD_DATADIR/test/oldt1.MYI;
1826
remove_file $MYSQLD_DATADIR/test/oldt1.MYD;
1827
copy_file $MYSQLD_DATADIR/test/t3.frm $MYSQLD_DATADIR/test/t1.frm;
1828
copy_file $MYSQLD_DATADIR/test/t3.MYI $MYSQLD_DATADIR/test/t1.MYI;
1829
copy_file $MYSQLD_DATADIR/test/t3.MYD $MYSQLD_DATADIR/test/t1.MYD;
1830
--error ER_CANT_REOPEN_TABLE
1833
DROP TABLE t1, t2, t3, m1;
1636
1835
--echo End of 5.1 tests