Bug #11011 Not possible to query a merge table
Submitted: 1 Jun 2005 8:26 Modified: 1 Jun 2005 11:36
Reporter: William de Vos Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.10 and 4.1.12 OS:Windows (WindowsXP)
Assigned to: CPU Architecture:Any

[1 Jun 2005 8:26] William de Vos
Description:
After troubles with our own tables I used the following example from the MySQL documentation (I only added the TYPE=MYISAM as in our installation InnoDB is the default engine).

Database query results in:
mysql> select * from total;
ERROR 1017 (HY000): Can't find file: 'total.MRG' (errno: 2)

File total.MRG is existing (in the database folder) and contains:
./admin_inoxdb/t1
./admin_inoxdb/t2
#INSERT_METHOD=LAST

On Linux this functionallity is working.

How to repeat:
Create tables:
CREATE TABLE t1 (
a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
message CHAR(20)) TYPE=MYISAM;
CREATE TABLE t2 (
a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
message CHAR(20)) TYPE=MYISAM;
INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1');
INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2');
CREATE TABLE total (
a INT NOT NULL AUTO_INCREMENT,
message CHAR(20), INDEX(a))
TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;

Query:
mysql> select * from total;
ERROR 1017 (HY000): Can't find file: 'total.MRG' (errno: 2)
[1 Jun 2005 9:28] Vasily Kishkin
Probably You need to update a version mysql server. I tried on 4.1.13:

mysql> CREATE TABLE t1 (
    -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    -> message CHAR(20)) TYPE=MYISAM;
Query OK, 0 rows affected, 1 warning (0.05 sec)

mysql> CREATE TABLE t2 (
    -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    -> message CHAR(20)) TYPE=MYISAM;
Query OK, 0 rows affected, 1 warning (0.08 sec)

mysql> INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1');
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2');
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> CREATE TABLE total (
    -> a INT NOT NULL AUTO_INCREMENT,
    -> message CHAR(20), INDEX(a))
    -> TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
Query OK, 0 rows affected, 1 warning (0.05 sec)

mysql> select * from total;
+---+---------+
| a | message |
+---+---------+
| 1 | Testing |
| 2 | table   |
| 3 | t1      |
| 1 | Testing |
| 2 | table   |
| 3 | t2      |
+---+---------+
6 rows in set (0.01 sec)

mysql>
[1 Jun 2005 11:36] MySQL Verification Team
This is related to bug:

http://bugs.mysql.com/bug.php?id=10687
[1 Jun 2005 14:08] William de Vos
I Just downloaded 4.1.12a for Windows.
It works fine with this version.