datetime类型
取值范围:0001-01-01 00:00:00.000000 9999-12-31 23:59:59.999999
create table t(id datetime)默认值为null
默认情况下支持六位精度,即datetime DEFAULT '2023-07-27
10:00:01.999999'插入数据时带六位精度,但建表时设置列的默认值为当前时间(datetime default now())插入数据时不带六位精度。控制参数gcluster_datetime_with_microsec(默认为0)=1、_gbase_timestamp_append_prec=1后使default now()支持六位精度,支持指定时间精度(精度:0-6)的函数有:now()、sysdate()、localtime()
没有自动更新列
timestamp类型
取值范围:1970-01-01 08:00:01
2038-01-01 00:59:59
默认情况下不支持六位精度,设置集群层和单机层控制参数_gbase_timestamp_append_prec=1、gcluster_datetime_with_microsec=1后,支持六位精度,支持指定时间精度(0-6)的函数有:now、sysdate、localtime、localtimestamp、current_timestamp(其中now()与now(0)一样不带六位精度)
处于表的第一列同时为timestamp的列为自动更新列,参数打开更新时,自动更新列会自动更新为当前带微妙的时间
create table t(id timestamp)默认值为current time,timestamp只允许一列为当前时间
id timestamp只能在timestamp类型的第一列
参数:
_gbase_timestamp_append_prec参数控制所有时间戳微秒功能,是总开关
gcluster_datetime_with_microsec参数只控制列的时间戳类型的默认值是否带微秒,本参数生效的前提是_gbase_timestamp_append_prec参数已打开,列的默认值带时间戳需要2个参数都打开,包括集群层和单机




