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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1
    • Fix Version/s: 10.1.7
    • Component/s: Virtual Columns
    • Labels:
      None
    • Sprint:
      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]> 
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              sanja Oleksandr Byelkin added a comment -

              OK to push.

              Show
              sanja Oleksandr Byelkin added a comment - OK to push.

                People

                • Assignee:
                  bar Alexander Barkov
                  Reporter:
                  bar Alexander Barkov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Agile