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

CREATE .. SELECT VALUES produces invalid table structure

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (i INT);
      # For 10.3 the next statement needs to be changed to VALUE(i)
      CREATE TABLE t2 AS SELECT VALUES(i) AS a FROM t1;
      SHOW CREATE TABLE t2;
       
      # Cleanup
      DROP TABLE IF EXISTS t1, t2;
      

      storage_engine=MyISAM

      MariaDB [test]> SHOW CREATE TABLE t2;
      +-------+------------------------------------------------------------------------------------+
      | Table | Create Table                                                                       |
      +-------+------------------------------------------------------------------------------------+
      | t2    | CREATE TABLE `t2` (
        `a` null DEFAULT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
      +-------+------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
      

      storage_engine=InnoDB

      MariaDB [test]> CREATE TABLE t2 AS SELECT VALUES(i) AS a FROM t1;
      ERROR 1005 (HY000): Can't create table `test`.`t2` (errno: 168 "Unknown (generic) error from engine")
      MariaDB [test]> SHOW WARNINGS;
      +---------+------+----------------------------------------------------------------------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                                                                                      |
      +---------+------+----------------------------------------------------------------------------------------------------------------------------------------------+
      | Warning | 1005 | Error creating table 'test/t2' with column 'a'. Please check its column type and try to re-create the table with an appropriate column type. |
      | Error   | 1005 | Can't create table `test`.`t2` (errno: 168 "Unknown (generic) error from engine")                                                            |
      | Warning | 1030 | Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB                                                               |
      +---------+------+----------------------------------------------------------------------------------------------------------------------------------------------+
      3 rows in set (0.00 sec)
      

      Reproducible with 5.5-10.3, and also MySQL 5.5; seems to be fixed in 5.6+.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.