Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT

在DBeaver执行DDL语句时报错:SQL 错误 [1293] [HY000]: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
DDL语句如下:

CREATE TABLE `etl_conf_d` (
  `jobName` varchar(128) NOT NULL,
  `jobNo` int(11) DEFAULT NULL,
  `jobDesc` varchar(128) DEFAULT NULL,
  `validFlg` varchar(1) DEFAULT NULL,
  `runFlg` varchar(1) DEFAULT NULL,
  `runStartTimestamp` TIMESTAMP ,
  `runEndTimestamp` TIMESTAMP,
  `finalEndTimestamp` TIMESTAMP,
  `queryMinute` int(11) NOT NULL DEFAULT 0,
  `etlStartTimestamp` TIMESTAMP ,
  `etlEndTimestamp` TIMESTAMP ,
  `createUser` varchar(128) DEFAULT NULL,
  `createTimestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `evtUser` varchar(128) DEFAULT NULL,
  `evtTimestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`jobName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
;




查阅发现是MySQL版本的问题。MySQL低版本不支持在一个表里面有两个TIMESTAMP类型。
检查MySQL版本:

C:\Users\xuqy>mysql -V
mysql  Ver 8.0.22 for Win64 on x86_64 (MySQL Community Server - GPL)

发现我的MySQL版本并不低。
然后我继续检查了我DBeaver,发现驱动版本是5.1.44更换驱动,问题解决。

上一篇:Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) 异常原因及处理


下一篇:sql又双叒叕报错了