我想在memsql中创建一个表,其中一个列作为datetime,它的值将是当前日期时间。我试过将now()、current_time()和current_date()作为默认值,但没有任何效果。
singlestore> create table y (col2 datetime default now());
ERROR 1067 (42000): Invalid default value for 'col2'或
singlestore> create table y (col2 datetime default current_timestamp());
ERROR 1067 (42000): Invalid default value for 'col2'或
singlestore> create table y (col2 datetime default current_date());
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'current_date())' at line 1版本Server version: 5.5.58 MemSQL source distribution (compatible; MySQL Enterprise & MySQL Commercial)
谢谢。
发布于 2022-06-23 14:11:02
这是正确的语法。您使用的是哪个版本的SinglestoreDB?
singlestore [test]> create table y (col2 datetime default now());
Query OK, 0 rows affected (1.691 sec)编辑:这至少需要一个7.0版的SinglestoreDB。旧版本只支持时间戳列上的默认now(),而不支持datetime。
https://stackoverflow.com/questions/72731359
复制相似问题