我正在使用来自current_timestamp的datediff查询时间戳列.但它给出了错误.
DATEDIFF(minute, timestamp_field ,current_timestamp::TIMESTAMP)
or
DATEDIFF(minute, timestamp_field ,current_timestamp)
DataType of timestamp_field is "TIMESTAMP DEFAULT '2016-03-29 20:33:33.404256'::timestamp without time zone"
输出:
ERROR: Specified types or functions (one per INFO message) not
supported on Redshift tables.Warnings: Function “”timestamp”(timestamp with time zone)” not
supported. Function “timestamptz(timestamp with time zone,integer)”
not supported. Function “timestamptz(text)” not supported.
但是如果我使用getdate()函数,则以下查询正在运行
DATEDIFF(minute, timestamp_field ,getdate()::TIMESTAMP)
最佳答案 我只是简单地将带有时区的时间戳转换为时间戳,它正在运行.
例:
select datediff(min, CURRENT_TIMESTAMP::timestamp, CURRENT_TIMESTAMP::timestamp);