[MDEV-8441] Bad SHOW CREATE TABLE output for a table with a virtual column Created: 2015-07-10  Updated: 2015-11-03  Resolved: 2015-08-10

Status: Closed
Project: MariaDB Server
Component/s: Virtual Columns
Affects Version/s: 10.1
Fix Version/s: 10.1.7

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-3929 Add system variable explicit_defaults... Closed
Duplicate
is duplicated by MDEV-5614 timestamp virtual column yields synta... Closed
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]> 



 Comments   
Comment by Oleksandr Byelkin [ 2015-07-15 ]

OK to push.

Generated at Thu Feb 08 07:27:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.