当源时间列和新时间列具有相同的名称时,我在 timescaledb(基于物化视图)上创建连续聚合时遇到问题,如下所示:
CREATE MATERIALIZED VIEW IF NOT EXISTS minute_table
WITH (timescaledb.continuous) AS
SELECT
time_bucket(INTERVAL '1 minute', my_time_col) AS my_time_col,
...
FROM source_table
GROUP BY my_time_col
WITH NO DATA;
我收到以下错误:
ERROR: continuous aggregate view must include a valid time bucket function
但是如果我像下面的例子那样改变新的时间列名称就可以了:
CREATE MATERIALIZED VIEW IF NOT EXISTS minute_table
WITH (timescaledb.continuous) AS
SELECT
time_bucket(INTERVAL '1 minute', my_time_col) AS my_time_col_asdf,
...
FROM source_table
GROUP BY my_time_col_asdf
WITH NO DATA;
我该如何解决这个问题?我需要源和新时间列具有相同的名称...