Bug #10895 Can't find file: 'total.MRG' (errno: 2)
Submitted: 26 May 2005 23:12 Modified: 26 May 2005 23:28
Reporter: james lee Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S1 (Critical)
Version:4.1.12-nt OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[26 May 2005 23:12] james lee
Description:
The following error exists when creating a MERGE table: Can't find file: 'total.MRG' (errno: 2)

Execute: show table status;
---------------------------
mysql> show table status;
+-------+--------+---------+------------+------+----------------+------------+--
----------------+--------------+-----------+----------------+-------------------
--+-------------+------------+-------------------+----------+----------------+--
---------------------------------------+
| Name  | Engine | Version | Row_format | Rows | Avg_row_length | Data_length |
Max_data_length | Index_length | Data_free | Auto_increment | Create_time
  | Update_time | Check_time | Collation         | Checksum | Create_options | C
omment                                 |
+-------+--------+---------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+-------------------
--+-------------+------------+-------------------+----------+----------------+--
---------------------------------------+
| t1    | InnoDB |       9 | Fixed      |    3 |           5461 |       16384 |
           NULL |            0 |         0 |              4 | 2005-05-26 16:05:4
2 | NULL        | NULL       | latin1_swedish_ci |     NULL |                | I
nnoDB free: 11264 kB                   |
| t2    | InnoDB |       9 | Fixed      |    3 |           5461 |       16384 |
           NULL |            0 |         0 |              4 | 2005-05-26 16:06:0
7 | NULL        | NULL       | latin1_swedish_ci |     NULL |                | I
nnoDB free: 11264 kB                   |
| total | NULL   |    NULL | NULL       | NULL |           NULL |        NULL |
           NULL |         NULL |      NULL |           NULL | NULL
  | NULL        | NULL       | NULL              |     NULL | NULL           | C
an't find file: 'total.MRG' (errno: 2) |
+-------+--------+---------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+-------------------
--+-------------+------------+-------------------+----------+----------------+--
---------------------------------------+
3 rows in set (0.00 sec)

How to repeat:
Example: Create 2 myisam tables and 1 merge table
-------------------------------------------------
mysql> CREATE TABLE t1 (
    ->    a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ->    message CHAR(20));
mysql> CREATE TABLE t2 (
    ->    a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ->    message CHAR(20));
mysql> INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1');
mysql> INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2');
mysql> CREATE TABLE total (
    ->    a INT NOT NULL AUTO_INCREMENT,
    ->    message CHAR(20), INDEX(a))
    ->    TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;

Suggested fix:
No workaround.
[26 May 2005 23:16] james lee
Sorry, the MyISAM engine type needs to be used:

Create tables:
--------------
CREATE TABLE t1 (
        a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
        message CHAR(20)) ENGINE=MYISAM;
CREATE TABLE t2 (
        a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
        message CHAR(20)) ENGINE=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;

Verify error:
-----------
mysql> show table status;
+-------+--------+---------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+-------------------
--+---------------------+------------+-------------------+----------+-----------
-----+-----------------------------------------+
| Name  | Engine | Version | Row_format | Rows | Avg_row_length | Data_length |
Max_data_length | Index_length | Data_free | Auto_increment | Create_time
  | Update_time         | Check_time | Collation         | Checksum | Create_opt
ions | Comment                                 |
+-------+--------+---------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+-------------------
--+---------------------+------------+-------------------+----------+-----------
-----+-----------------------------------------+
| t1    | MyISAM |       9 | Fixed      |    3 |             25 |          75 |
   107374182399 |         2048 |         0 |              4 | 2005-05-26 16:14:3
8 | 2005-05-26 16:14:44 | NULL       | latin1_swedish_ci |     NULL |
     |                                         |
| t2    | MyISAM |       9 | Fixed      |    3 |             25 |          75 |
   107374182399 |         2048 |         0 |              4 | 2005-05-26 16:14:3
8 | 2005-05-26 16:14:44 | NULL       | latin1_swedish_ci |     NULL |
     |                                         |
| total | NULL   |    NULL | NULL       | NULL |           NULL |        NULL |
           NULL |         NULL |      NULL |           NULL | NULL
  | NULL                | NULL       | NULL              |     NULL | NULL
     | Can't find file: 'total.MRG' (errno: 2) |
+-------+--------+---------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+-------------------
--+---------------------+------------+-------------------+----------+-----------
-----+-----------------------------------------+
3 rows in set (0.00 sec)
[26 May 2005 23:28] Jim Winstead
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Will be fixed in the upcoming 4.1.12a release for Microsoft Windows.