我想计算开始时间(类型变量timestamptz
)和NOW()
我的函数完成时间之间的差异。
select * from _get_date_diff_ms(NOW(), NOW())
将 supbase.io 与 PG 13.3 一起使用,我收到以下错误消息:
operator does not exist: timestamp with time zone - double precision"
CREATE OR REPLACE FUNCTION _get_date_diff_ms(p_begin_time timestamptz, p_end_time timestamptz)
RETURNS int AS
$$
BEGIN
RETURN ROUND ((
EXTRACT (EPOCH FROM p_begin_time -
EXTRACT (EPOCH FROM p_end_time)
) * 1000));
END;
$$ LANGUAGE plpgsql;