Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5040

MERGE on MyISAM tables with different column names

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • 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?

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            serg Sergei Golubchik added a comment -

            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.

            Show
            serg Sergei Golubchik added a comment - 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.
            Hide
            f_razzoli Federico Razzoli added a comment -

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

            Show
            f_razzoli Federico Razzoli added a comment - Thank you. I'll add this info in the KB, because it doesnt seem obvious, for a user

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                f_razzoli Federico Razzoli
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: