我想执行这个简单的查询:
SELECT
pid,
MIN(interval '5 minutes' - current_timestamp - state_change)
FROM
pg_stat_activity
AND
current_timestamp - state_change <= interval '5 minutes'
GROUP BY
pid
ORDER BY
2 ASC
LIMIT 1;
interval
但是 PG 抱怨and之间没有运算符timestamp with time zone
。
如何将我的时间间隔转换为时间戳?