这不会编译:
SELECT add_compression_policy(
hypertable => 'exchange.candles',
compress_after => INTERVAL ((SELECT now()::DATE::timestamp - (SELECT min(last_ts) FROM exchange.capture_tracker))),
if_not_exists => TRUE);
问题似乎SELECT
如下INTERVAL
。
但这编译:
WITH delay AS (SELECT now()::DATE::timestamp - (SELECT min(last_ts) FROM exchange.capture_tracker) myinterval)
SELECT add_compression_policy(
hypertable => 'exchange.candles',
compress_after => myinterval,
if_not_exists => TRUE) FROM delay;
我的同事和我不明白为什么。
谁能解释一下?