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

Bad SHOW CREATE TABLE output for a table with a virtual column

    XMLWordPrintable

Details

    • 10.1.6-2

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)));
      SHOW CREATE TABLE t1;

      returns:

      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                                       |
      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `a` datetime DEFAULT NULL,
        `b` timestamp AS (timestamp(a)) VIRTUAL NULL ON UPDATE CURRENT_TIMESTAMP
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+

      Now if I copy the SHOW ouput and paste it into the client, it returns syntax error:

      MariaDB [test]> CREATE TABLE `t1` (`a` datetime DEFAULT NULL, `b` timestamp AS (timestamp(a)) VIRTUAL NULL ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1' at line 1
      MariaDB [test]> 

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.