mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-20 04:35:00 +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)
|
if (!(IsA(col_arg, Var)) || ((Var *) col_arg)->varattno != tbinfo->htpartcolno)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg(
|
errmsg("time bucket function must reference the primary hypertable "
|
||||||
"time bucket function must reference a hypertable dimension column")));
|
"dimension column")));
|
||||||
|
|
||||||
if (list_length(fe->args) >= 3)
|
if (list_length(fe->args) >= 3)
|
||||||
{
|
{
|
||||||
|
@ -70,14 +70,14 @@ AS
|
|||||||
Select max(temperature)
|
Select max(temperature)
|
||||||
from conditions
|
from conditions
|
||||||
group by time_bucket('1week', timemeasure) , location WITH NO DATA;
|
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
|
--time_bucket on expression
|
||||||
CREATE MATERIALIZED VIEW mat_m1 WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
CREATE MATERIALIZED VIEW mat_m1 WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
||||||
AS
|
AS
|
||||||
Select max(temperature)
|
Select max(temperature)
|
||||||
from conditions
|
from conditions
|
||||||
group by time_bucket('1week', timec+ '10 minutes'::interval) , location WITH NO DATA;
|
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
|
--multiple time_bucket functions
|
||||||
CREATE MATERIALIZED VIEW mat_m1 WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
CREATE MATERIALIZED VIEW mat_m1 WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
||||||
AS
|
AS
|
||||||
@ -369,14 +369,14 @@ as
|
|||||||
select time_bucket(100, timec), min(location), sum(temperature),sum(humidity)
|
select time_bucket(100, timec), min(location), sum(temperature),sum(humidity)
|
||||||
from conditions
|
from conditions
|
||||||
group by time_bucket(100, timec) WITH NO DATA;
|
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)
|
create materialized view mat_with_test( timec, minl, sumt , sumh)
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
||||||
as
|
as
|
||||||
select time_bucket(100, timec), min(location), sum(temperature),sum(humidity)
|
select time_bucket(100, timec), min(location), sum(temperature),sum(humidity)
|
||||||
from conditions
|
from conditions
|
||||||
group by time_bucket(100, timec) WITH NO DATA;
|
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;
|
ALTER TABLE conditions ALTER timec type int;
|
||||||
create materialized view mat_with_test( timec, minl, sumt , sumh)
|
create materialized view mat_with_test( timec, minl, sumt , sumh)
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
WITH (timescaledb.continuous, timescaledb.materialized_only=false)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user