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

timestamp virtual column yields syntax error in show create table

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.3.12, 5.5.35, 10.0.7
    • Fix Version/s: 5.3.13, 10.0, 5.5
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux x64

      Description

      You cannot mysqldump/reload the table in the below testcase due to invalid sql being returned by "show create table".

      drop table if exists t1;
      create table t1(a int, b timestamp as (a=1) virtual)engine=innodb;
      show create table t1;
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            sudheera Sudheera Palihakkara added a comment -

            Hi,
            I'd like to know more information on this issue where is this testcase located? thanks

            Show
            sudheera Sudheera Palihakkara added a comment - Hi, I'd like to know more information on this issue where is this testcase located? thanks
            Hide
            sbester1 sbester1 added a comment -

            The problem is very simple. Look at it, you cannot create a table shown by 'show create table':

            mysql> create table t1(a int, b timestamp as (a=1) virtual)engine=innodb;
            Query OK, 0 rows affected (0.39 sec)
            
            mysql> show create table t1;
            +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
            | Table | Create Table                                                                                                                                             |
            +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
            | t1    | CREATE TABLE `t1` (
              `a` int(11) DEFAULT NULL,
              `b` timestamp AS (a=1) VIRTUAL NULL ON UPDATE CURRENT_TIMESTAMP
            ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
            +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
            1 row in set (0.04 sec)
            
            mysql> drop table if exists `t1`;
            Query OK, 0 rows affected (0.19 sec)
            
            mysql>
            mysql> CREATE TABLE `t1` (
                ->   `a` int(11) DEFAULT NULL,
                ->   `b` timestamp AS (a=1) 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 3
            mysql>
            
            Show
            sbester1 sbester1 added a comment - The problem is very simple. Look at it, you cannot create a table shown by 'show create table': mysql> create table t1(a int, b timestamp as (a=1) virtual)engine=innodb; Query OK, 0 rows affected (0.39 sec) mysql> show create table t1; +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp AS (a=1) VIRTUAL NULL ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.04 sec) mysql> drop table if exists `t1`; Query OK, 0 rows affected (0.19 sec) mysql> mysql> CREATE TABLE `t1` ( -> `a` int(11) DEFAULT NULL, -> `b` timestamp AS (a=1) 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 3 mysql>

              People

              • Assignee:
                igor Igor Babaev
                Reporter:
                sbester1 sbester1
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: