mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-19 04:03:06 +08:00
Make CAgg error message more clear
When creating a Continuous Aggregate we can only reference the primary hypertable dimension column on the `time_bucket` function, so reworded a bit the error message to be more clear.
This commit is contained in:
parent
8e6994b4be
commit
3ec04e1a1d
@ -201,8 +201,8 @@ caggtimebucket_validate(CAggTimebucketInfo *tbinfo, List *groupClause, List *tar
|
||||
if (!(IsA(col_arg, Var)) || ((Var *) col_arg)->varattno != tbinfo->htpartcolno)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg(
|
||||
"time bucket function must reference a hypertable dimension column")));
|
||||
errmsg("time bucket function must reference the primary hypertable "
|
||||
"dimension column")));
|
||||
|
||||
if (list_length(fe->args) >= 3)
|
||||
{
|
||||
|
@ -70,14 +70,14 @@ AS
|
||||
Select max(temperature)
|
||||
from conditions
|
||||
group by time_bucket('1week', timemeasure) , location WITH NO DATA;
|
||||
ERROR: time bucket function must reference a hypertable dimension column
|
||||
ERROR: time bucket function must reference the primary hypertable dimension column
|
||||
--time_bucket on expression
|
||||
CREATE MATERIALIZED VIEW mat_m1 WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
||||
AS
|
||||
Select max(temperature)
|
||||
from conditions
|
||||
group by time_bucket('1week', timec+ '10 minutes'::interval) , location WITH NO DATA;
|
||||
ERROR: time bucket function must reference a hypertable dimension column
|
||||
ERROR: time bucket function must reference the primary hypertable dimension column
|
||||
--multiple time_bucket functions
|
||||
CREATE MATERIALIZED VIEW mat_m1 WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
||||
AS
|
||||
@ -369,14 +369,14 @@ as
|
||||
select time_bucket(100, timec), min(location), sum(temperature),sum(humidity)
|
||||
from conditions
|
||||
group by time_bucket(100, timec) WITH NO DATA;
|
||||
ERROR: time bucket function must reference a hypertable dimension column
|
||||
ERROR: time bucket function must reference the primary hypertable dimension column
|
||||
create materialized view mat_with_test( timec, minl, sumt , sumh)
|
||||
WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
||||
as
|
||||
select time_bucket(100, timec), min(location), sum(temperature),sum(humidity)
|
||||
from conditions
|
||||
group by time_bucket(100, timec) WITH NO DATA;
|
||||
ERROR: time bucket function must reference a hypertable dimension column
|
||||
ERROR: time bucket function must reference the primary hypertable dimension column
|
||||
ALTER TABLE conditions ALTER timec type int;
|
||||
create materialized view mat_with_test( timec, minl, sumt , sumh)
|
||||
WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user