greenplum 之sysdate

在Greenplum里面没有Oracle里面的sysdate,很多时候使用to_timestamp(current_timestamp,'yyyy-mm-dd hh24:mi:ss')代替;

但是在GP的函数中使用current_timestamp来记录日志,并不能达到效果,一个函数就是一个事务

因为在同一个事务中current_timestamp这个值是不变的,故取而代之使用clock_timestamp();

如select cast(to_timestamp(clock_timestamp(),'yyyy-mm-dd hh24:mi:SS') as timestamp without time zone)

你可能感兴趣的:(greenplum 之sysdate)