[MDEV-5040] MERGE on MyISAM tables with different column names Created: 2013-09-19  Updated: 2013-09-20  Resolved: 2013-09-20

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Federico Razzoli Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

In the following example, t3 has a column named c instead of b. But everything seems to work, even when a SELECT explicitly names b:

MariaDB [test]> CREATE TABLE t1 (
    -> a INT,
    -> b INT
    -> ) ENGINE = MyISAM;
Query OK, 0 rows affected (0.07 sec)
 
MariaDB [test]> CREATE TABLE t2 (
    -> a INT,
    -> b INT
    -> ) ENGINE = MyISAM;
Query OK, 0 rows affected (0.06 sec)
 
MariaDB [test]> CREATE TABLE t3 (
    -> a INT,
    -> c INT
    -> ) ENGINE = MyISAM;
Query OK, 0 rows affected (0.02 sec)
 
MariaDB [test]> CREATE TABLE t_mrg (
    -> a INT,
    -> b INT
    -> ) ENGINE = MERGE,UNION=(t1,t2,t3);
Query OK, 0 rows affected (0.02 sec)
 
MariaDB [test]> INSERT INTO t1 VALUES (1,1);
Query OK, 1 row affected (0.02 sec)
 
MariaDB [test]> INSERT INTO t3 VALUES (2,2);
Query OK, 1 row affected (0.00 sec)
 
MariaDB [test]> SELECT a,b FROM t_mrg;
+------+------+
| a    | b    |
+------+------+
|    1 |    1 |
|    2 |    2 |
+------+------+
2 rows in set (0.00 sec)

From MySQL manual:
http://dev.mysql.com/doc/refman/5.5/en/merge-storage-engine.html
The MERGE storage engine, also known as the MRG_MyISAM engine, is a collection of identical MyISAM tables that can be used as one. “Identical” means that all tables have identical column and index information.
As far as I understand, this includes column names?



 Comments   
Comment by Sergei Golubchik [ 2013-09-20 ]

No, really it doesn't include column names. MyISAM has no knowledge of column names and MERGE engine accesses MyISAM tables via the MyISAM API, so it also does not know not care about column names. Or Index names, for what it's worth.

Comment by Federico Razzoli [ 2013-09-20 ]

Thank you. I'll add this info in the KB, because it doesnt seem obvious, for a user

Generated at Thu Feb 08 07:01:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.