mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-20 04:35:00 +08:00
Enable joins for heirarchical continuous aggregates
The joins could be between a continuous aggregate and hypertable, continuous aggregate and a regular Postgres table, and continuous aggregate and a regular Postgres view.
This commit is contained in:
parent
777c599a34
commit
98218c1d07
@ -14,6 +14,7 @@ accidentally triggering the load of a previous DB version.**
|
|||||||
* #5252 Improve unique constraint support on compressed hypertables
|
* #5252 Improve unique constraint support on compressed hypertables
|
||||||
* #5312 Add timeout support to ping_data_node()
|
* #5312 Add timeout support to ping_data_node()
|
||||||
* #5454 Add support for ON CONFLICT DO UPDATE for compressed hypertables
|
* #5454 Add support for ON CONFLICT DO UPDATE for compressed hypertables
|
||||||
|
* #5344 Enable JOINS for Hierarchical Continuous Aggregates
|
||||||
|
|
||||||
**Bugfixes**
|
**Bugfixes**
|
||||||
* #5396 Fix SEGMENTBY columns predicates to be pushed down
|
* #5396 Fix SEGMENTBY columns predicates to be pushed down
|
||||||
@ -49,7 +50,6 @@ We recommend that you upgrade at the next available opportunity.
|
|||||||
* #5364 Fix num_chunks inconsistency in hypertables view
|
* #5364 Fix num_chunks inconsistency in hypertables view
|
||||||
* #5367 Fix column name handling in old-style continuous aggregates
|
* #5367 Fix column name handling in old-style continuous aggregates
|
||||||
* #5378 Fix multinode DML HA performance regression
|
* #5378 Fix multinode DML HA performance regression
|
||||||
* #5384 Fix Hierarchical Continuous Aggregates chunk_interval_size
|
|
||||||
* #5304 Fix sub-second intervals in hierarchical caggs
|
* #5304 Fix sub-second intervals in hierarchical caggs
|
||||||
|
|
||||||
**Thanks**
|
**Thanks**
|
||||||
@ -84,6 +84,10 @@ Sooner to that time, we will announce the specific version of TimescaleDB in whi
|
|||||||
* #5246 Make connection establishment interruptible
|
* #5246 Make connection establishment interruptible
|
||||||
* #5253 Make data node command execution interruptible
|
* #5253 Make data node command execution interruptible
|
||||||
* #5262 Extend enabling compression on a continuous aggregrate with 'compress_segmentby' and 'compress_orderby' parameters
|
* #5262 Extend enabling compression on a continuous aggregrate with 'compress_segmentby' and 'compress_orderby' parameters
|
||||||
|
* #5343 Set PortalContext when starting job
|
||||||
|
* #5312 Add timeout support to the ping_data_node()
|
||||||
|
* #5212 Allow pushdown of reference table joins
|
||||||
|
* #5344 Enable JOINS for Hierarchical continuous aggregates
|
||||||
|
|
||||||
**Bugfixes**
|
**Bugfixes**
|
||||||
* #4926 Fix corruption when inserting into compressed chunks
|
* #4926 Fix corruption when inserting into compressed chunks
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include <parser/parse_oper.h>
|
#include <parser/parse_oper.h>
|
||||||
#include <parser/parse_relation.h>
|
#include <parser/parse_relation.h>
|
||||||
#include <parser/parse_type.h>
|
#include <parser/parse_type.h>
|
||||||
|
#include <parser/parsetree.h>
|
||||||
#include <rewrite/rewriteHandler.h>
|
#include <rewrite/rewriteHandler.h>
|
||||||
#include <rewrite/rewriteManip.h>
|
#include <rewrite/rewriteManip.h>
|
||||||
#include <utils/acl.h>
|
#include <utils/acl.h>
|
||||||
@ -1284,31 +1285,42 @@ cagg_validate_query(const Query *query, const bool finalized, const char *cagg_s
|
|||||||
op = (OpExpr *) join->quals;
|
op = (OpExpr *) join->quals;
|
||||||
rte = list_nth(query->rtable, ((RangeTblRef *) join->larg)->rtindex - 1);
|
rte = list_nth(query->rtable, ((RangeTblRef *) join->larg)->rtindex - 1);
|
||||||
rte_other = list_nth(query->rtable, ((RangeTblRef *) join->rarg)->rtindex - 1);
|
rte_other = list_nth(query->rtable, ((RangeTblRef *) join->rarg)->rtindex - 1);
|
||||||
}
|
if (rte->subquery != NULL || rte_other->subquery != NULL)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Cagg with joins does not support hierarchical caggs in from clause.
|
|
||||||
*/
|
|
||||||
if (rte->relkind == RELKIND_VIEW || rte_other->relkind == RELKIND_VIEW)
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("joins for hierarchical continuous aggregates are not supported")));
|
errmsg("invalid continuous aggregate view"),
|
||||||
|
errdetail("sub-queries are not supported in FROM clause")));
|
||||||
|
RangeTblEntry *jrte = rt_fetch(join->rtindex, query->rtable);
|
||||||
|
if (jrte->joinaliasvars == NIL)
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
|
errmsg("invalid continuous aggregate view")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error out if there is aynthing else than one normal table and one hypertable
|
* Error out if there is aynthing else than one normal table and one hypertable
|
||||||
* in the from clause, e.g. sub-query.
|
* in the from clause, e.g. sub-query, lateral, two hypertables, etc.
|
||||||
*/
|
*/
|
||||||
if (((rte->relkind != RELKIND_RELATION && rte->relkind != RELKIND_VIEW) ||
|
if (rte->lateral || rte_other->lateral)
|
||||||
rte->tablesample || rte->inh == false) ||
|
ereport(ERROR,
|
||||||
((rte_other->relkind != RELKIND_RELATION && rte_other->relkind != RELKIND_VIEW) ||
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
rte_other->tablesample || rte_other->inh == false) ||
|
errmsg("invalid continuous aggregate view"),
|
||||||
|
errdetail("lateral are not supported in FROM clause")));
|
||||||
|
if ((rte->relkind == RELKIND_VIEW && ts_is_hypertable(rte_other->relid)) ||
|
||||||
|
(rte_other->relkind == RELKIND_VIEW && ts_is_hypertable(rte->relid)))
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
|
errmsg("invalid continuous aggregate view"),
|
||||||
|
errdetail("views are not supported in FROM clause")));
|
||||||
|
if (rte->relkind != RELKIND_VIEW && rte_other->relkind != RELKIND_VIEW &&
|
||||||
(ts_is_hypertable(rte->relid) == ts_is_hypertable(rte_other->relid)))
|
(ts_is_hypertable(rte->relid) == ts_is_hypertable(rte_other->relid)))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("invalid continuous aggregate view"),
|
errmsg("invalid continuous aggregate view"),
|
||||||
errdetail("from clause can only have one hypertable and one normal table")));
|
errdetail("multiple hypertables or normal tables"
|
||||||
|
" are not supported in FROM clause")));
|
||||||
|
|
||||||
/* Only inner joins are allowed. */
|
/* Only inner joins are allowed. */
|
||||||
if (jointype != JOIN_INNER)
|
if (jointype != JOIN_INNER)
|
||||||
@ -1340,6 +1352,11 @@ cagg_validate_query(const Query *query, const bool finalized, const char *cagg_s
|
|||||||
* that we know which one is hypertable to carry out the related
|
* that we know which one is hypertable to carry out the related
|
||||||
* processing in later parts of code.
|
* processing in later parts of code.
|
||||||
*/
|
*/
|
||||||
|
if (rte->relkind == RELKIND_VIEW)
|
||||||
|
normal_table_id = rte_other->relid;
|
||||||
|
else if (rte_other->relkind == RELKIND_VIEW)
|
||||||
|
normal_table_id = rte->relid;
|
||||||
|
else
|
||||||
normal_table_id = ts_is_hypertable(rte->relid) ? rte_other->relid : rte->relid;
|
normal_table_id = ts_is_hypertable(rte->relid) ? rte_other->relid : rte->relid;
|
||||||
if (normal_table_id == rte->relid)
|
if (normal_table_id == rte->relid)
|
||||||
rte = rte_other;
|
rte = rte_other;
|
||||||
@ -2450,7 +2467,9 @@ finalizequery_get_select_query(FinalizeQueryInfo *inp, List *matcollist,
|
|||||||
* which contains the information of the materialised hypertable
|
* which contains the information of the materialised hypertable
|
||||||
* that is created for this cagg.
|
* that is created for this cagg.
|
||||||
*/
|
*/
|
||||||
if (list_length(inp->final_userquery->jointree->fromlist) >= CONTINUOUS_AGG_MAX_JOIN_RELATIONS)
|
if (list_length(inp->final_userquery->jointree->fromlist) >=
|
||||||
|
CONTINUOUS_AGG_MAX_JOIN_RELATIONS ||
|
||||||
|
!IsA(linitial(inp->final_userquery->jointree->fromlist), RangeTblRef))
|
||||||
{
|
{
|
||||||
rte = makeNode(RangeTblEntry);
|
rte = makeNode(RangeTblEntry);
|
||||||
rte->alias = makeAlias(relname, NIL);
|
rte->alias = makeAlias(relname, NIL);
|
||||||
@ -2458,6 +2477,18 @@ finalizequery_get_select_query(FinalizeQueryInfo *inp, List *matcollist,
|
|||||||
rte->inh = true;
|
rte->inh = true;
|
||||||
rte->rellockmode = 1;
|
rte->rellockmode = 1;
|
||||||
rte->eref = copyObject(rte->alias);
|
rte->eref = copyObject(rte->alias);
|
||||||
|
ListCell *l;
|
||||||
|
foreach (l, inp->final_userquery->jointree->fromlist)
|
||||||
|
{
|
||||||
|
Node *jtnode = (Node *) lfirst(l);
|
||||||
|
JoinExpr *join = NULL;
|
||||||
|
if (IsA(jtnode, JoinExpr))
|
||||||
|
{
|
||||||
|
join = castNode(JoinExpr, jtnode);
|
||||||
|
RangeTblEntry *jrte = rt_fetch(join->rtindex, inp->final_userquery->rtable);
|
||||||
|
rte->joinaliasvars = jrte->joinaliasvars;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rte = llast_node(RangeTblEntry, inp->final_userquery->rtable);
|
rte = llast_node(RangeTblEntry, inp->final_userquery->rtable);
|
||||||
@ -3411,12 +3442,17 @@ build_union_query(CAggTimebucketInfo *tbinfo, int matpartcolno, Query *q1, Query
|
|||||||
*/
|
*/
|
||||||
if (list_length(q2->rtable) == CONTINUOUS_AGG_MAX_JOIN_RELATIONS)
|
if (list_length(q2->rtable) == CONTINUOUS_AGG_MAX_JOIN_RELATIONS)
|
||||||
{
|
{
|
||||||
|
Oid normal_table_id = InvalidOid;
|
||||||
RangeTblRef *rtref = linitial_node(RangeTblRef, q2->jointree->fromlist);
|
RangeTblRef *rtref = linitial_node(RangeTblRef, q2->jointree->fromlist);
|
||||||
RangeTblEntry *rte = list_nth(q2->rtable, rtref->rtindex - 1);
|
RangeTblEntry *rte = list_nth(q2->rtable, rtref->rtindex - 1);
|
||||||
RangeTblRef *rtref_other = lsecond_node(RangeTblRef, q2->jointree->fromlist);
|
RangeTblRef *rtref_other = lsecond_node(RangeTblRef, q2->jointree->fromlist);
|
||||||
RangeTblEntry *rte_other = list_nth(q2->rtable, rtref_other->rtindex - 1);
|
RangeTblEntry *rte_other = list_nth(q2->rtable, rtref_other->rtindex - 1);
|
||||||
|
if (rte->relkind == RELKIND_VIEW)
|
||||||
Oid normal_table_id = ts_is_hypertable(rte->relid) ? rte_other->relid : rte->relid;
|
normal_table_id = rte_other->relid;
|
||||||
|
else if (rte_other->relkind == RELKIND_VIEW)
|
||||||
|
normal_table_id = rte->relid;
|
||||||
|
else
|
||||||
|
normal_table_id = ts_is_hypertable(rte->relid) ? rte_other->relid : rte->relid;
|
||||||
if (normal_table_id == rte->relid)
|
if (normal_table_id == rte->relid)
|
||||||
varno = 2;
|
varno = 2;
|
||||||
else
|
else
|
||||||
|
@ -193,10 +193,11 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
AVG(temperature),
|
AVG(temperature),
|
||||||
MAX(temperature),
|
MAX(temperature),
|
||||||
MIN(temperature),
|
MIN(temperature),
|
||||||
name
|
name,
|
||||||
|
devices.device_id AS thermo_id
|
||||||
FROM conditions, devices
|
FROM conditions, devices
|
||||||
WHERE conditions.device_id = devices.device_id
|
WHERE conditions.device_id = devices.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket, thermo_id;
|
||||||
NOTICE: refreshing continuous aggregate "conditions_summary_daily"
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
||||||
@ -297,7 +298,7 @@ select temperature, count(*) from conditions,
|
|||||||
LATERAL (Select * from mat_t1 where a = conditions.temperature) q
|
LATERAL (Select * from mat_t1 where a = conditions.temperature) q
|
||||||
group by temperature WITH NO DATA;
|
group by temperature WITH NO DATA;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: lateral are not supported in FROM clause
|
||||||
--Error out if from clause has view
|
--Error out if from clause has view
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_view
|
CREATE MATERIALIZED VIEW conditions_summary_daily_view
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -310,13 +311,15 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
FROM conditions, devices_view
|
FROM conditions, devices_view
|
||||||
WHERE conditions.device_id = devices_view.device_id
|
WHERE conditions.device_id = devices_view.device_id
|
||||||
GROUP BY name, bucket, devices_view.device_id;
|
GROUP BY name, bucket, devices_view.device_id;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
ERROR: invalid continuous aggregate view
|
||||||
|
DETAIL: views are not supported in FROM clause
|
||||||
-- Nested CAgg over a CAgg with join
|
-- Nested CAgg over a CAgg with join
|
||||||
CREATE MATERIALIZED VIEW cagg_on_cagg
|
CREATE MATERIALIZED VIEW cagg_on_cagg
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
||||||
SUM(avg) AS temperature
|
SUM(avg) AS temperature
|
||||||
FROM conditions_summary_daily
|
FROM conditions_summary_daily, devices
|
||||||
|
WHERE devices.device_id = conditions_summary_daily.thermo_id
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
NOTICE: refreshing continuous aggregate "cagg_on_cagg"
|
NOTICE: refreshing continuous aggregate "cagg_on_cagg"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
@ -337,7 +340,7 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
FROM conditions JOIN (SELECT * FROM devices WHERE location in (SELECT name from cities where currency = 'EUR')) dev ON conditions.device_id = dev.device_id
|
FROM conditions JOIN (SELECT * FROM devices WHERE location in (SELECT name from cities where currency = 'EUR')) dev ON conditions.device_id = dev.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: sub-queries are not supported in FROM clause
|
||||||
DROP TABLE cities CASCADE;
|
DROP TABLE cities CASCADE;
|
||||||
--Error out when join is between two hypertables
|
--Error out when join is between two hypertables
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_ht
|
CREATE MATERIALIZED VIEW conditions_summary_daily_ht
|
||||||
@ -350,7 +353,7 @@ FROM conditions, conditions_dup
|
|||||||
WHERE conditions.device_id = conditions_dup.device_id
|
WHERE conditions.device_id = conditions_dup.device_id
|
||||||
GROUP BY bucket;
|
GROUP BY bucket;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: multiple hypertables or normal tables are not supported in FROM clause
|
||||||
--Error out when join is between two normal tables
|
--Error out when join is between two normal tables
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nt
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nt
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -363,7 +366,7 @@ FROM devices, devices_dup
|
|||||||
WHERE devices.device_id = devices_dup.device_id
|
WHERE devices.device_id = devices_dup.device_id
|
||||||
GROUP BY devices.name, devices.location;
|
GROUP BY devices.name, devices.location;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: multiple hypertables or normal tables are not supported in FROM clause
|
||||||
--Error out when join is on non-equality condition
|
--Error out when join is on non-equality condition
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_unequal
|
CREATE MATERIALIZED VIEW conditions_summary_daily_unequal
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -432,25 +435,27 @@ WHERE conditions.device_id = devices.device_id
|
|||||||
GROUP BY name, bucket, devices.device_id;
|
GROUP BY name, bucket, devices.device_id;
|
||||||
NOTICE: refreshing continuous aggregate "conditions_summary_daily_cagg"
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily_cagg"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
--Errors out for join between cagg and normal table
|
--Join between cagg and normal table
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
devices.name
|
devices.name
|
||||||
FROM conditions_summary_daily_cagg cagg, devices
|
FROM conditions_summary_daily_cagg cagg, devices
|
||||||
WHERE cagg.device_id = devices.device_id
|
WHERE cagg.device_id = devices.device_id
|
||||||
GROUP BY devices.name, bucket;
|
GROUP BY 1,2;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily_nested"
|
||||||
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
--Error out for join between cagg and hypertable
|
--Error out for join between cagg and hypertable
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested_ht
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
cagg.name,
|
cagg.name,
|
||||||
conditions.temperature
|
conditions.temperature
|
||||||
FROM conditions_summary_daily_cagg cagg, conditions
|
FROM conditions_summary_daily_cagg cagg, conditions
|
||||||
WHERE cagg.device_id = conditions.device_id
|
WHERE cagg.device_id = conditions.device_id
|
||||||
GROUP BY conditions.temperature, bucket, cagg.name;
|
GROUP BY 1,2,3;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
ERROR: invalid continuous aggregate view
|
||||||
|
DETAIL: views are not supported in FROM clause
|
||||||
\set VERBOSITY terse
|
\set VERBOSITY terse
|
||||||
DROP TABLE conditions CASCADE;
|
DROP TABLE conditions CASCADE;
|
||||||
NOTICE: drop cascades to 15 other objects
|
NOTICE: drop cascades to 15 other objects
|
||||||
@ -459,8 +464,11 @@ NOTICE: drop cascades to 2 other objects
|
|||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
ERROR: cannot drop view conditions_summary_daily_cagg because other objects depend on it
|
||||||
DROP TABLE devices CASCADE;
|
DROP TABLE devices CASCADE;
|
||||||
NOTICE: drop cascades to view devices_view
|
NOTICE: drop cascades to 18 other objects
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
ERROR: cannot drop the partial/direct view because it is required by a continuous aggregate
|
||||||
DROP TABLE conditions_dup CASCADE;
|
DROP TABLE conditions_dup CASCADE;
|
||||||
DROP TABLE devices_dup CASCADE;
|
DROP TABLE devices_dup CASCADE;
|
||||||
|
@ -193,10 +193,11 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
AVG(temperature),
|
AVG(temperature),
|
||||||
MAX(temperature),
|
MAX(temperature),
|
||||||
MIN(temperature),
|
MIN(temperature),
|
||||||
name
|
name,
|
||||||
|
devices.device_id AS thermo_id
|
||||||
FROM conditions, devices
|
FROM conditions, devices
|
||||||
WHERE conditions.device_id = devices.device_id
|
WHERE conditions.device_id = devices.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket, thermo_id;
|
||||||
NOTICE: refreshing continuous aggregate "conditions_summary_daily"
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
||||||
@ -298,7 +299,7 @@ select temperature, count(*) from conditions,
|
|||||||
LATERAL (Select * from mat_t1 where a = conditions.temperature) q
|
LATERAL (Select * from mat_t1 where a = conditions.temperature) q
|
||||||
group by temperature WITH NO DATA;
|
group by temperature WITH NO DATA;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: lateral are not supported in FROM clause
|
||||||
--Error out if from clause has view
|
--Error out if from clause has view
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_view
|
CREATE MATERIALIZED VIEW conditions_summary_daily_view
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -311,13 +312,15 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
FROM conditions, devices_view
|
FROM conditions, devices_view
|
||||||
WHERE conditions.device_id = devices_view.device_id
|
WHERE conditions.device_id = devices_view.device_id
|
||||||
GROUP BY name, bucket, devices_view.device_id;
|
GROUP BY name, bucket, devices_view.device_id;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
ERROR: invalid continuous aggregate view
|
||||||
|
DETAIL: views are not supported in FROM clause
|
||||||
-- Nested CAgg over a CAgg with join
|
-- Nested CAgg over a CAgg with join
|
||||||
CREATE MATERIALIZED VIEW cagg_on_cagg
|
CREATE MATERIALIZED VIEW cagg_on_cagg
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
||||||
SUM(avg) AS temperature
|
SUM(avg) AS temperature
|
||||||
FROM conditions_summary_daily
|
FROM conditions_summary_daily, devices
|
||||||
|
WHERE devices.device_id = conditions_summary_daily.thermo_id
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
NOTICE: refreshing continuous aggregate "cagg_on_cagg"
|
NOTICE: refreshing continuous aggregate "cagg_on_cagg"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
@ -338,7 +341,7 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
FROM conditions JOIN (SELECT * FROM devices WHERE location in (SELECT name from cities where currency = 'EUR')) dev ON conditions.device_id = dev.device_id
|
FROM conditions JOIN (SELECT * FROM devices WHERE location in (SELECT name from cities where currency = 'EUR')) dev ON conditions.device_id = dev.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: sub-queries are not supported in FROM clause
|
||||||
DROP TABLE cities CASCADE;
|
DROP TABLE cities CASCADE;
|
||||||
--Error out when join is between two hypertables
|
--Error out when join is between two hypertables
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_ht
|
CREATE MATERIALIZED VIEW conditions_summary_daily_ht
|
||||||
@ -351,7 +354,7 @@ FROM conditions, conditions_dup
|
|||||||
WHERE conditions.device_id = conditions_dup.device_id
|
WHERE conditions.device_id = conditions_dup.device_id
|
||||||
GROUP BY bucket;
|
GROUP BY bucket;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: multiple hypertables or normal tables are not supported in FROM clause
|
||||||
--Error out when join is between two normal tables
|
--Error out when join is between two normal tables
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nt
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nt
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -364,7 +367,7 @@ FROM devices, devices_dup
|
|||||||
WHERE devices.device_id = devices_dup.device_id
|
WHERE devices.device_id = devices_dup.device_id
|
||||||
GROUP BY devices.name, devices.location;
|
GROUP BY devices.name, devices.location;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: multiple hypertables or normal tables are not supported in FROM clause
|
||||||
--Error out when join is on non-equality condition
|
--Error out when join is on non-equality condition
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_unequal
|
CREATE MATERIALIZED VIEW conditions_summary_daily_unequal
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -433,25 +436,27 @@ WHERE conditions.device_id = devices.device_id
|
|||||||
GROUP BY name, bucket, devices.device_id;
|
GROUP BY name, bucket, devices.device_id;
|
||||||
NOTICE: refreshing continuous aggregate "conditions_summary_daily_cagg"
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily_cagg"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
--Errors out for join between cagg and normal table
|
--Join between cagg and normal table
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
devices.name
|
devices.name
|
||||||
FROM conditions_summary_daily_cagg cagg, devices
|
FROM conditions_summary_daily_cagg cagg, devices
|
||||||
WHERE cagg.device_id = devices.device_id
|
WHERE cagg.device_id = devices.device_id
|
||||||
GROUP BY devices.name, bucket;
|
GROUP BY 1,2;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily_nested"
|
||||||
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
--Error out for join between cagg and hypertable
|
--Error out for join between cagg and hypertable
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested_ht
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
cagg.name,
|
cagg.name,
|
||||||
conditions.temperature
|
conditions.temperature
|
||||||
FROM conditions_summary_daily_cagg cagg, conditions
|
FROM conditions_summary_daily_cagg cagg, conditions
|
||||||
WHERE cagg.device_id = conditions.device_id
|
WHERE cagg.device_id = conditions.device_id
|
||||||
GROUP BY conditions.temperature, bucket, cagg.name;
|
GROUP BY 1,2,3;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
ERROR: invalid continuous aggregate view
|
||||||
|
DETAIL: views are not supported in FROM clause
|
||||||
\set VERBOSITY terse
|
\set VERBOSITY terse
|
||||||
DROP TABLE conditions CASCADE;
|
DROP TABLE conditions CASCADE;
|
||||||
NOTICE: drop cascades to 24 other objects
|
NOTICE: drop cascades to 24 other objects
|
||||||
@ -463,8 +468,11 @@ NOTICE: drop cascades to 2 other objects
|
|||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
ERROR: cannot drop view conditions_summary_daily_cagg because other objects depend on it
|
||||||
DROP TABLE devices CASCADE;
|
DROP TABLE devices CASCADE;
|
||||||
NOTICE: drop cascades to view devices_view
|
NOTICE: drop cascades to 27 other objects
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
ERROR: cannot drop the partial/direct view because it is required by a continuous aggregate
|
||||||
DROP TABLE conditions_dup CASCADE;
|
DROP TABLE conditions_dup CASCADE;
|
||||||
DROP TABLE devices_dup CASCADE;
|
DROP TABLE devices_dup CASCADE;
|
||||||
|
@ -193,10 +193,11 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
AVG(temperature),
|
AVG(temperature),
|
||||||
MAX(temperature),
|
MAX(temperature),
|
||||||
MIN(temperature),
|
MIN(temperature),
|
||||||
name
|
name,
|
||||||
|
devices.device_id AS thermo_id
|
||||||
FROM conditions, devices
|
FROM conditions, devices
|
||||||
WHERE conditions.device_id = devices.device_id
|
WHERE conditions.device_id = devices.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket, thermo_id;
|
||||||
NOTICE: refreshing continuous aggregate "conditions_summary_daily"
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
||||||
@ -298,7 +299,7 @@ select temperature, count(*) from conditions,
|
|||||||
LATERAL (Select * from mat_t1 where a = conditions.temperature) q
|
LATERAL (Select * from mat_t1 where a = conditions.temperature) q
|
||||||
group by temperature WITH NO DATA;
|
group by temperature WITH NO DATA;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: lateral are not supported in FROM clause
|
||||||
--Error out if from clause has view
|
--Error out if from clause has view
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_view
|
CREATE MATERIALIZED VIEW conditions_summary_daily_view
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -311,13 +312,15 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
FROM conditions, devices_view
|
FROM conditions, devices_view
|
||||||
WHERE conditions.device_id = devices_view.device_id
|
WHERE conditions.device_id = devices_view.device_id
|
||||||
GROUP BY name, bucket, devices_view.device_id;
|
GROUP BY name, bucket, devices_view.device_id;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
ERROR: invalid continuous aggregate view
|
||||||
|
DETAIL: views are not supported in FROM clause
|
||||||
-- Nested CAgg over a CAgg with join
|
-- Nested CAgg over a CAgg with join
|
||||||
CREATE MATERIALIZED VIEW cagg_on_cagg
|
CREATE MATERIALIZED VIEW cagg_on_cagg
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
||||||
SUM(avg) AS temperature
|
SUM(avg) AS temperature
|
||||||
FROM conditions_summary_daily
|
FROM conditions_summary_daily, devices
|
||||||
|
WHERE devices.device_id = conditions_summary_daily.thermo_id
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
NOTICE: refreshing continuous aggregate "cagg_on_cagg"
|
NOTICE: refreshing continuous aggregate "cagg_on_cagg"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
@ -338,7 +341,7 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
FROM conditions JOIN (SELECT * FROM devices WHERE location in (SELECT name from cities where currency = 'EUR')) dev ON conditions.device_id = dev.device_id
|
FROM conditions JOIN (SELECT * FROM devices WHERE location in (SELECT name from cities where currency = 'EUR')) dev ON conditions.device_id = dev.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: sub-queries are not supported in FROM clause
|
||||||
DROP TABLE cities CASCADE;
|
DROP TABLE cities CASCADE;
|
||||||
--Error out when join is between two hypertables
|
--Error out when join is between two hypertables
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_ht
|
CREATE MATERIALIZED VIEW conditions_summary_daily_ht
|
||||||
@ -351,7 +354,7 @@ FROM conditions, conditions_dup
|
|||||||
WHERE conditions.device_id = conditions_dup.device_id
|
WHERE conditions.device_id = conditions_dup.device_id
|
||||||
GROUP BY bucket;
|
GROUP BY bucket;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: multiple hypertables or normal tables are not supported in FROM clause
|
||||||
--Error out when join is between two normal tables
|
--Error out when join is between two normal tables
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nt
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nt
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -364,7 +367,7 @@ FROM devices, devices_dup
|
|||||||
WHERE devices.device_id = devices_dup.device_id
|
WHERE devices.device_id = devices_dup.device_id
|
||||||
GROUP BY devices.name, devices.location;
|
GROUP BY devices.name, devices.location;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: multiple hypertables or normal tables are not supported in FROM clause
|
||||||
--Error out when join is on non-equality condition
|
--Error out when join is on non-equality condition
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_unequal
|
CREATE MATERIALIZED VIEW conditions_summary_daily_unequal
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -433,25 +436,27 @@ WHERE conditions.device_id = devices.device_id
|
|||||||
GROUP BY name, bucket, devices.device_id;
|
GROUP BY name, bucket, devices.device_id;
|
||||||
NOTICE: refreshing continuous aggregate "conditions_summary_daily_cagg"
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily_cagg"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
--Errors out for join between cagg and normal table
|
--Join between cagg and normal table
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
devices.name
|
devices.name
|
||||||
FROM conditions_summary_daily_cagg cagg, devices
|
FROM conditions_summary_daily_cagg cagg, devices
|
||||||
WHERE cagg.device_id = devices.device_id
|
WHERE cagg.device_id = devices.device_id
|
||||||
GROUP BY devices.name, bucket;
|
GROUP BY 1,2;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily_nested"
|
||||||
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
--Error out for join between cagg and hypertable
|
--Error out for join between cagg and hypertable
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested_ht
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
cagg.name,
|
cagg.name,
|
||||||
conditions.temperature
|
conditions.temperature
|
||||||
FROM conditions_summary_daily_cagg cagg, conditions
|
FROM conditions_summary_daily_cagg cagg, conditions
|
||||||
WHERE cagg.device_id = conditions.device_id
|
WHERE cagg.device_id = conditions.device_id
|
||||||
GROUP BY conditions.temperature, bucket, cagg.name;
|
GROUP BY 1,2,3;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
ERROR: invalid continuous aggregate view
|
||||||
|
DETAIL: views are not supported in FROM clause
|
||||||
\set VERBOSITY terse
|
\set VERBOSITY terse
|
||||||
DROP TABLE conditions CASCADE;
|
DROP TABLE conditions CASCADE;
|
||||||
NOTICE: drop cascades to 24 other objects
|
NOTICE: drop cascades to 24 other objects
|
||||||
@ -463,8 +468,11 @@ NOTICE: drop cascades to 2 other objects
|
|||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
ERROR: cannot drop view conditions_summary_daily_cagg because other objects depend on it
|
||||||
DROP TABLE devices CASCADE;
|
DROP TABLE devices CASCADE;
|
||||||
NOTICE: drop cascades to view devices_view
|
NOTICE: drop cascades to 27 other objects
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
ERROR: cannot drop the partial/direct view because it is required by a continuous aggregate
|
||||||
DROP TABLE conditions_dup CASCADE;
|
DROP TABLE conditions_dup CASCADE;
|
||||||
DROP TABLE devices_dup CASCADE;
|
DROP TABLE devices_dup CASCADE;
|
||||||
|
@ -193,10 +193,11 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
AVG(temperature),
|
AVG(temperature),
|
||||||
MAX(temperature),
|
MAX(temperature),
|
||||||
MIN(temperature),
|
MIN(temperature),
|
||||||
name
|
name,
|
||||||
|
devices.device_id AS thermo_id
|
||||||
FROM conditions, devices
|
FROM conditions, devices
|
||||||
WHERE conditions.device_id = devices.device_id
|
WHERE conditions.device_id = devices.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket, thermo_id;
|
||||||
NOTICE: refreshing continuous aggregate "conditions_summary_daily"
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
||||||
@ -298,7 +299,7 @@ select temperature, count(*) from conditions,
|
|||||||
LATERAL (Select * from mat_t1 where a = conditions.temperature) q
|
LATERAL (Select * from mat_t1 where a = conditions.temperature) q
|
||||||
group by temperature WITH NO DATA;
|
group by temperature WITH NO DATA;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: lateral are not supported in FROM clause
|
||||||
--Error out if from clause has view
|
--Error out if from clause has view
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_view
|
CREATE MATERIALIZED VIEW conditions_summary_daily_view
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -311,13 +312,15 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
FROM conditions, devices_view
|
FROM conditions, devices_view
|
||||||
WHERE conditions.device_id = devices_view.device_id
|
WHERE conditions.device_id = devices_view.device_id
|
||||||
GROUP BY name, bucket, devices_view.device_id;
|
GROUP BY name, bucket, devices_view.device_id;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
ERROR: invalid continuous aggregate view
|
||||||
|
DETAIL: views are not supported in FROM clause
|
||||||
-- Nested CAgg over a CAgg with join
|
-- Nested CAgg over a CAgg with join
|
||||||
CREATE MATERIALIZED VIEW cagg_on_cagg
|
CREATE MATERIALIZED VIEW cagg_on_cagg
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
||||||
SUM(avg) AS temperature
|
SUM(avg) AS temperature
|
||||||
FROM conditions_summary_daily
|
FROM conditions_summary_daily, devices
|
||||||
|
WHERE devices.device_id = conditions_summary_daily.thermo_id
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
NOTICE: refreshing continuous aggregate "cagg_on_cagg"
|
NOTICE: refreshing continuous aggregate "cagg_on_cagg"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
@ -338,7 +341,7 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
FROM conditions JOIN (SELECT * FROM devices WHERE location in (SELECT name from cities where currency = 'EUR')) dev ON conditions.device_id = dev.device_id
|
FROM conditions JOIN (SELECT * FROM devices WHERE location in (SELECT name from cities where currency = 'EUR')) dev ON conditions.device_id = dev.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: sub-queries are not supported in FROM clause
|
||||||
DROP TABLE cities CASCADE;
|
DROP TABLE cities CASCADE;
|
||||||
--Error out when join is between two hypertables
|
--Error out when join is between two hypertables
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_ht
|
CREATE MATERIALIZED VIEW conditions_summary_daily_ht
|
||||||
@ -351,7 +354,7 @@ FROM conditions, conditions_dup
|
|||||||
WHERE conditions.device_id = conditions_dup.device_id
|
WHERE conditions.device_id = conditions_dup.device_id
|
||||||
GROUP BY bucket;
|
GROUP BY bucket;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: multiple hypertables or normal tables are not supported in FROM clause
|
||||||
--Error out when join is between two normal tables
|
--Error out when join is between two normal tables
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nt
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nt
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -364,7 +367,7 @@ FROM devices, devices_dup
|
|||||||
WHERE devices.device_id = devices_dup.device_id
|
WHERE devices.device_id = devices_dup.device_id
|
||||||
GROUP BY devices.name, devices.location;
|
GROUP BY devices.name, devices.location;
|
||||||
ERROR: invalid continuous aggregate view
|
ERROR: invalid continuous aggregate view
|
||||||
DETAIL: from clause can only have one hypertable and one normal table
|
DETAIL: multiple hypertables or normal tables are not supported in FROM clause
|
||||||
--Error out when join is on non-equality condition
|
--Error out when join is on non-equality condition
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_unequal
|
CREATE MATERIALIZED VIEW conditions_summary_daily_unequal
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -433,25 +436,27 @@ WHERE conditions.device_id = devices.device_id
|
|||||||
GROUP BY name, bucket, devices.device_id;
|
GROUP BY name, bucket, devices.device_id;
|
||||||
NOTICE: refreshing continuous aggregate "conditions_summary_daily_cagg"
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily_cagg"
|
||||||
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
--Errors out for join between cagg and normal table
|
--Join between cagg and normal table
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
devices.name
|
devices.name
|
||||||
FROM conditions_summary_daily_cagg cagg, devices
|
FROM conditions_summary_daily_cagg cagg, devices
|
||||||
WHERE cagg.device_id = devices.device_id
|
WHERE cagg.device_id = devices.device_id
|
||||||
GROUP BY devices.name, bucket;
|
GROUP BY 1,2;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
NOTICE: refreshing continuous aggregate "conditions_summary_daily_nested"
|
||||||
|
HINT: Use WITH NO DATA if you do not want to refresh the continuous aggregate on creation.
|
||||||
--Error out for join between cagg and hypertable
|
--Error out for join between cagg and hypertable
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested_ht
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
cagg.name,
|
cagg.name,
|
||||||
conditions.temperature
|
conditions.temperature
|
||||||
FROM conditions_summary_daily_cagg cagg, conditions
|
FROM conditions_summary_daily_cagg cagg, conditions
|
||||||
WHERE cagg.device_id = conditions.device_id
|
WHERE cagg.device_id = conditions.device_id
|
||||||
GROUP BY conditions.temperature, bucket, cagg.name;
|
GROUP BY 1,2,3;
|
||||||
ERROR: joins for hierarchical continuous aggregates are not supported
|
ERROR: invalid continuous aggregate view
|
||||||
|
DETAIL: views are not supported in FROM clause
|
||||||
\set VERBOSITY terse
|
\set VERBOSITY terse
|
||||||
DROP TABLE conditions CASCADE;
|
DROP TABLE conditions CASCADE;
|
||||||
NOTICE: drop cascades to 24 other objects
|
NOTICE: drop cascades to 24 other objects
|
||||||
@ -463,8 +468,11 @@ NOTICE: drop cascades to 2 other objects
|
|||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
NOTICE: drop cascades to 2 other objects
|
ERROR: cannot drop view conditions_summary_daily_cagg because other objects depend on it
|
||||||
DROP TABLE devices CASCADE;
|
DROP TABLE devices CASCADE;
|
||||||
NOTICE: drop cascades to view devices_view
|
NOTICE: drop cascades to 27 other objects
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
NOTICE: drop cascades to 2 other objects
|
||||||
|
ERROR: cannot drop the partial/direct view because it is required by a continuous aggregate
|
||||||
DROP TABLE conditions_dup CASCADE;
|
DROP TABLE conditions_dup CASCADE;
|
||||||
DROP TABLE devices_dup CASCADE;
|
DROP TABLE devices_dup CASCADE;
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4423
tsl/test/expected/cagg_on_cagg_joins.out
Normal file
4423
tsl/test/expected/cagg_on_cagg_joins.out
Normal file
File diff suppressed because it is too large
Load Diff
4861
tsl/test/expected/cagg_on_cagg_joins_dist_ht.out
Normal file
4861
tsl/test/expected/cagg_on_cagg_joins_dist_ht.out
Normal file
File diff suppressed because it is too large
Load Diff
@ -64,6 +64,8 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
|
|||||||
cagg_multi.sql
|
cagg_multi.sql
|
||||||
cagg_on_cagg.sql
|
cagg_on_cagg.sql
|
||||||
cagg_on_cagg_dist_ht.sql
|
cagg_on_cagg_dist_ht.sql
|
||||||
|
cagg_on_cagg_joins.sql
|
||||||
|
cagg_on_cagg_joins_dist_ht.sql
|
||||||
continuous_aggs_deprecated.sql
|
continuous_aggs_deprecated.sql
|
||||||
cagg_tableam.sql
|
cagg_tableam.sql
|
||||||
cagg_usage.sql
|
cagg_usage.sql
|
||||||
|
@ -96,10 +96,11 @@ SELECT time_bucket(INTERVAL '1 day', day) AS bucket,
|
|||||||
AVG(temperature),
|
AVG(temperature),
|
||||||
MAX(temperature),
|
MAX(temperature),
|
||||||
MIN(temperature),
|
MIN(temperature),
|
||||||
name
|
name,
|
||||||
|
devices.device_id AS thermo_id
|
||||||
FROM conditions, devices
|
FROM conditions, devices
|
||||||
WHERE conditions.device_id = devices.device_id
|
WHERE conditions.device_id = devices.device_id
|
||||||
GROUP BY name, bucket;
|
GROUP BY name, bucket, thermo_id;
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
CREATE MATERIALIZED VIEW conditions_summary_daily_reorder
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
@ -211,7 +212,8 @@ CREATE MATERIALIZED VIEW cagg_on_cagg
|
|||||||
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', bucket) AS bucket,
|
||||||
SUM(avg) AS temperature
|
SUM(avg) AS temperature
|
||||||
FROM conditions_summary_daily
|
FROM conditions_summary_daily, devices
|
||||||
|
WHERE devices.device_id = conditions_summary_daily.thermo_id
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
|
|
||||||
\set VERBOSITY terse
|
\set VERBOSITY terse
|
||||||
@ -319,24 +321,24 @@ FROM conditions, devices
|
|||||||
WHERE conditions.device_id = devices.device_id
|
WHERE conditions.device_id = devices.device_id
|
||||||
GROUP BY name, bucket, devices.device_id;
|
GROUP BY name, bucket, devices.device_id;
|
||||||
|
|
||||||
--Errors out for join between cagg and normal table
|
--Join between cagg and normal table
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
devices.name
|
devices.name
|
||||||
FROM conditions_summary_daily_cagg cagg, devices
|
FROM conditions_summary_daily_cagg cagg, devices
|
||||||
WHERE cagg.device_id = devices.device_id
|
WHERE cagg.device_id = devices.device_id
|
||||||
GROUP BY devices.name, bucket;
|
GROUP BY 1,2;
|
||||||
|
|
||||||
--Error out for join between cagg and hypertable
|
--Error out for join between cagg and hypertable
|
||||||
CREATE MATERIALIZED VIEW conditions_summary_daily_nested
|
CREATE MATERIALIZED VIEW conditions_summary_daily_nested_ht
|
||||||
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only = TRUE) AS
|
||||||
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
SELECT time_bucket(INTERVAL '1 day', cagg.bucket) AS bucket,
|
||||||
cagg.name,
|
cagg.name,
|
||||||
conditions.temperature
|
conditions.temperature
|
||||||
FROM conditions_summary_daily_cagg cagg, conditions
|
FROM conditions_summary_daily_cagg cagg, conditions
|
||||||
WHERE cagg.device_id = conditions.device_id
|
WHERE cagg.device_id = conditions.device_id
|
||||||
GROUP BY conditions.temperature, bucket, cagg.name;
|
GROUP BY 1,2,3;
|
||||||
|
|
||||||
\set VERBOSITY terse
|
\set VERBOSITY terse
|
||||||
DROP TABLE conditions CASCADE;
|
DROP TABLE conditions CASCADE;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\set IS_DISTRIBUTED FALSE
|
\set IS_DISTRIBUTED FALSE
|
||||||
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
||||||
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
||||||
|
\set IS_JOIN FALSE
|
||||||
-- ########################################################
|
-- ########################################################
|
||||||
-- ## INTEGER data type tests
|
-- ## INTEGER data type tests
|
||||||
-- ########################################################
|
-- ########################################################
|
||||||
|
@ -24,6 +24,7 @@ GRANT CREATE ON SCHEMA public TO :ROLE_DEFAULT_PERM_USER;
|
|||||||
\set IS_DISTRIBUTED TRUE
|
\set IS_DISTRIBUTED TRUE
|
||||||
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
||||||
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
||||||
|
\set IS_JOIN FALSE
|
||||||
|
|
||||||
-- ########################################################
|
-- ########################################################
|
||||||
-- ## INTEGER data type tests
|
-- ## INTEGER data type tests
|
||||||
|
288
tsl/test/sql/cagg_on_cagg_joins.sql
Normal file
288
tsl/test/sql/cagg_on_cagg_joins.sql
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
-- This file and its contents are licensed under the Timescale License.
|
||||||
|
-- Please see the included NOTICE for copyright information and
|
||||||
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
|
|
||||||
|
-- Global test variables
|
||||||
|
\set IS_DISTRIBUTED FALSE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
||||||
|
\set IS_JOIN TRUE
|
||||||
|
-- ########################################################
|
||||||
|
-- ## INTEGER data type tests
|
||||||
|
-- ########################################################
|
||||||
|
|
||||||
|
-- Current test variables
|
||||||
|
\set IS_TIME_DIMENSION FALSE
|
||||||
|
\set TIME_DIMENSION_DATATYPE INTEGER
|
||||||
|
\set CAGG_NAME_1ST_LEVEL conditions_summary_1_1
|
||||||
|
\set CAGG_NAME_2TH_LEVEL conditions_summary_2_5
|
||||||
|
\set CAGG_NAME_3TH_LEVEL conditions_summary_3_10
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Run common tests for INTEGER
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTEGER \'1\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTEGER \'5\''
|
||||||
|
\set BUCKET_WIDTH_3TH 'INTEGER \'10\''
|
||||||
|
|
||||||
|
-- Different order of time dimension in raw ht
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER FALSE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
-- Default tests
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER TRUE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for non-multiple bucket sizes
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTEGER \'2\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTEGER \'5\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because non-multiple bucket sizes'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for equal bucket sizes
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTEGER \'2\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTEGER \'2\''
|
||||||
|
\set WARNING_MESSAGE 'SHOULD WORK because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for bucket size less than source
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTEGER \'4\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTEGER \'2\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- ########################################################
|
||||||
|
-- ## TIMESTAMP data type tests
|
||||||
|
-- ########################################################
|
||||||
|
|
||||||
|
-- Current test variables
|
||||||
|
\set IS_TIME_DIMENSION TRUE
|
||||||
|
\set TIME_DIMENSION_DATATYPE TIMESTAMP
|
||||||
|
\set CAGG_NAME_1ST_LEVEL conditions_summary_1_hourly
|
||||||
|
\set CAGG_NAME_2TH_LEVEL conditions_summary_2_daily
|
||||||
|
\set CAGG_NAME_3TH_LEVEL conditions_summary_3_weekly
|
||||||
|
\set IS_JOIN TRUE
|
||||||
|
SET timezone TO 'UTC';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Run common tests for TIMESTAMP
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 hour\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_3TH 'INTERVAL \'1 week\''
|
||||||
|
|
||||||
|
-- Different order of time dimension in raw ht
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER FALSE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
-- Default tests
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER TRUE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for variable bucket on top of fixed bucket
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 month\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'60 days\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because is not allowed variable-size bucket on top of fixed-size bucket'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for non-multiple bucket sizes
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'2 hours\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'3 hours\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because non-multiple bucket sizes'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for equal bucket sizes
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 hour\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE 'SHOULD WORK because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for bucket size less than source
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'2 hours\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- ########################################################
|
||||||
|
-- ## TIMESTAMPTZ data type tests
|
||||||
|
-- ########################################################
|
||||||
|
|
||||||
|
-- Current test variables
|
||||||
|
\set IS_TIME_DIMENSION TRUE
|
||||||
|
\set TIME_DIMENSION_DATATYPE TIMESTAMPTZ
|
||||||
|
\set CAGG_NAME_1ST_LEVEL conditions_summary_1_hourly
|
||||||
|
\set CAGG_NAME_2TH_LEVEL conditions_summary_2_daily
|
||||||
|
\set CAGG_NAME_3TH_LEVEL conditions_summary_3_weekly
|
||||||
|
|
||||||
|
SET timezone TO 'UTC';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Run common tests for TIMESTAMPTZ
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 hour\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_3TH 'INTERVAL \'1 week\''
|
||||||
|
|
||||||
|
-- Different order of time dimension in raw ht
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER FALSE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
-- Default tests
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER TRUE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for variable bucket on top of fixed bucket
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 month\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'60 days\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because is not allowed variable-size bucket on top of fixed-size bucket'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for non-multiple bucket sizes
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'2 hours\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'3 hours\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because non-multiple bucket sizes'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for equal bucket sizes
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 hour\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE 'SHOULD WORK because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for bucket size less than source
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'2 hours\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validations using time bucket with timezone (ref issue #5126)
|
||||||
|
--
|
||||||
|
\set ON_ERROR_STOP 0
|
||||||
|
\set TIME_DIMENSION_DATATYPE TIMESTAMPTZ
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST TRUE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH TRUE
|
||||||
|
\set CAGG_NAME_1ST_LEVEL conditions_summary_1_5m
|
||||||
|
\set CAGG_NAME_2TH_LEVEL conditions_summary_2_1h
|
||||||
|
\set BUCKET_TZNAME_1ST 'US/Pacific'
|
||||||
|
\set BUCKET_TZNAME_2TH 'US/Pacific'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'5 minutes\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'5 minutes\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'16 minutes\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because non-multiple bucket sizes'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Variable bucket size with the same timezones
|
||||||
|
--
|
||||||
|
\set BUCKET_TZNAME_1ST 'UTC'
|
||||||
|
\set BUCKET_TZNAME_2TH 'UTC'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Variable bucket size with different timezones
|
||||||
|
--
|
||||||
|
\set BUCKET_TZNAME_1ST 'US/Pacific'
|
||||||
|
\set BUCKET_TZNAME_2TH 'UTC'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- TZ bucket on top of non-TZ bucket
|
||||||
|
--
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH TRUE
|
||||||
|
\set BUCKET_TZNAME_2TH 'UTC'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- non-TZ bucket on top of TZ bucket
|
||||||
|
--
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST TRUE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
||||||
|
\set BUCKET_TZNAME_1ST 'UTC'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- test some intuitive intervals that should work but
|
||||||
|
-- were not working due to unix epochs
|
||||||
|
-- validation test for 1 year on top of one day
|
||||||
|
-- validation test for 1 year on top of 1 month
|
||||||
|
-- validation test for 1 year on top of 1 week
|
||||||
|
|
||||||
|
-- bug report 5231
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 year\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'3 month\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 month\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 year\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 week\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 year\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 week\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
321
tsl/test/sql/cagg_on_cagg_joins_dist_ht.sql
Normal file
321
tsl/test/sql/cagg_on_cagg_joins_dist_ht.sql
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
-- This file and its contents are licensed under the Timescale License.
|
||||||
|
-- Please see the included NOTICE for copyright information and
|
||||||
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
|
|
||||||
|
------------------------------------
|
||||||
|
-- Set up a distributed environment
|
||||||
|
------------------------------------
|
||||||
|
\c :TEST_DBNAME :ROLE_CLUSTER_SUPERUSER
|
||||||
|
|
||||||
|
\set DATA_NODE_1 :TEST_DBNAME _1
|
||||||
|
\set DATA_NODE_2 :TEST_DBNAME _2
|
||||||
|
\set DATA_NODE_3 :TEST_DBNAME _3
|
||||||
|
|
||||||
|
\ir include/remote_exec.sql
|
||||||
|
|
||||||
|
SELECT (add_data_node (name, host => 'localhost', DATABASE => name)).*
|
||||||
|
FROM (VALUES (:'DATA_NODE_1'), (:'DATA_NODE_2'), (:'DATA_NODE_3')) v (name);
|
||||||
|
|
||||||
|
GRANT USAGE ON FOREIGN SERVER :DATA_NODE_1, :DATA_NODE_2, :DATA_NODE_3 TO PUBLIC;
|
||||||
|
-- PG15 requires this explicit GRANT on schema public
|
||||||
|
GRANT CREATE ON SCHEMA public TO :ROLE_DEFAULT_PERM_USER;
|
||||||
|
|
||||||
|
-- Global test variables
|
||||||
|
\set IS_DISTRIBUTED TRUE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
||||||
|
\set IS_JOIN TRUE
|
||||||
|
|
||||||
|
-- ########################################################
|
||||||
|
-- ## INTEGER data type tests
|
||||||
|
-- ########################################################
|
||||||
|
|
||||||
|
-- Current test variables
|
||||||
|
\set IS_TIME_DIMENSION FALSE
|
||||||
|
\set TIME_DIMENSION_DATATYPE INTEGER
|
||||||
|
\set CAGG_NAME_1ST_LEVEL conditions_summary_1_1
|
||||||
|
\set CAGG_NAME_2TH_LEVEL conditions_summary_2_5
|
||||||
|
\set CAGG_NAME_3TH_LEVEL conditions_summary_3_10
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Run common tests for INTEGER
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTEGER \'1\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTEGER \'5\''
|
||||||
|
\set BUCKET_WIDTH_3TH 'INTEGER \'10\''
|
||||||
|
|
||||||
|
-- Different order of time dimension in raw ht
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER FALSE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
-- Default tests
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER TRUE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
--
|
||||||
|
-- Validation test for non-multiple bucket sizes
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTEGER \'2\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTEGER \'5\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because non-multiple bucket sizes'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for equal bucket sizes
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTEGER \'2\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTEGER \'2\''
|
||||||
|
\set WARNING_MESSAGE 'SHOULD WORK because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for bucket size less than source
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTEGER \'4\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTEGER \'2\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- cleanup
|
||||||
|
DROP TABLE conditions;
|
||||||
|
|
||||||
|
-- ########################################################
|
||||||
|
-- ## TIMESTAMP data type tests
|
||||||
|
-- ########################################################
|
||||||
|
|
||||||
|
-- Current test variables
|
||||||
|
\set IS_TIME_DIMENSION TRUE
|
||||||
|
\set TIME_DIMENSION_DATATYPE TIMESTAMP
|
||||||
|
\set CAGG_NAME_1ST_LEVEL conditions_summary_1_hourly
|
||||||
|
\set CAGG_NAME_2TH_LEVEL conditions_summary_2_daily
|
||||||
|
\set CAGG_NAME_3TH_LEVEL conditions_summary_3_weekly
|
||||||
|
|
||||||
|
SET timezone TO 'UTC';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Run common tests for TIMESTAMP
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 hour\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_3TH 'INTERVAL \'1 week\''
|
||||||
|
|
||||||
|
-- Different order of time dimension in raw ht
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER FALSE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
-- Default tests
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER TRUE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for variable bucket on top of fixed bucket
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 month\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'60 days\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because is not allowed variable-size bucket on top of fixed-size bucket'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for non-multiple bucket sizes
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'2 hours\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'3 hours\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because non-multiple bucket sizes'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for equal bucket sizes
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 hour\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE 'SHOULD WORK because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for bucket size less than source
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'2 hours\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- ########################################################
|
||||||
|
-- ## TIMESTAMPTZ data type tests
|
||||||
|
-- ########################################################
|
||||||
|
|
||||||
|
-- Current test variables
|
||||||
|
\set IS_TIME_DIMENSION TRUE
|
||||||
|
\set TIME_DIMENSION_DATATYPE TIMESTAMPTZ
|
||||||
|
\set CAGG_NAME_1ST_LEVEL conditions_summary_1_hourly
|
||||||
|
\set CAGG_NAME_2TH_LEVEL conditions_summary_2_daily
|
||||||
|
\set CAGG_NAME_3TH_LEVEL conditions_summary_3_weekly
|
||||||
|
|
||||||
|
SET timezone TO 'UTC';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Run common tests for TIMESTAMPTZ
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 hour\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_3TH 'INTERVAL \'1 week\''
|
||||||
|
|
||||||
|
-- Different order of time dimension in raw ht
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER FALSE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
-- Default tests
|
||||||
|
\set IS_DEFAULT_COLUMN_ORDER TRUE
|
||||||
|
\ir include/cagg_on_cagg_setup.sql
|
||||||
|
\ir include/cagg_on_cagg_common.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for variable bucket on top of fixed bucket
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 month\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'60 days\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because is not allowed variable-size bucket on top of fixed-size bucket'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for non-multiple bucket sizes
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'2 hours\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'3 hours\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because non-multiple bucket sizes'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for equal bucket sizes
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 hour\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE 'SHOULD WORK because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validation test for bucket size less than source
|
||||||
|
--
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'2 hours\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because new bucket should be greater than previous'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Validations using time bucket with timezone (ref issue #5126)
|
||||||
|
--
|
||||||
|
\set TIME_DIMENSION_DATATYPE TIMESTAMPTZ
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST TRUE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH TRUE
|
||||||
|
\set CAGG_NAME_1ST_LEVEL conditions_summary_1_5m
|
||||||
|
\set CAGG_NAME_2TH_LEVEL conditions_summary_2_1h
|
||||||
|
\set BUCKET_TZNAME_1ST 'US/Pacific'
|
||||||
|
\set BUCKET_TZNAME_2TH 'US/Pacific'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'5 minutes\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 hour\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'5 minutes\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'16 minutes\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD ERROR because non-multiple bucket sizes'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Variable bucket size with the same timezones
|
||||||
|
--
|
||||||
|
\set BUCKET_TZNAME_1ST 'UTC'
|
||||||
|
\set BUCKET_TZNAME_2TH 'UTC'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Variable bucket size with different timezones
|
||||||
|
--
|
||||||
|
\set BUCKET_TZNAME_1ST 'US/Pacific'
|
||||||
|
\set BUCKET_TZNAME_2TH 'UTC'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- TZ bucket on top of non-TZ bucket
|
||||||
|
--
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH TRUE
|
||||||
|
\set BUCKET_TZNAME_2TH 'UTC'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
--
|
||||||
|
-- non-TZ bucket on top of TZ bucket
|
||||||
|
--
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST TRUE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
||||||
|
\set BUCKET_TZNAME_1ST 'UTC'
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\set WARNING_MESSAGE '-- SHOULD WORK'
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- bug report 5231
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 year\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 day\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'3 month\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 month\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 year\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 week\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 year\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'1 week\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1 month\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- bug report 5277
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_1ST FALSE
|
||||||
|
\set IS_TIME_DIMENSION_WITH_TIMEZONE_2TH FALSE
|
||||||
|
|
||||||
|
-- epoch plus cast to int would compute a bucket width of 0 for parent
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'146 ms\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1168 ms\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'9344 ms\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'74752 ms\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'74752 ms\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'598016 ms\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- test microseconds - should pass
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'146 usec\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1168 usec\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- test microseconds - SHOULD FAIL
|
||||||
|
\set BUCKET_WIDTH_1ST 'INTERVAL \'146 usec\''
|
||||||
|
\set BUCKET_WIDTH_2TH 'INTERVAL \'1160 usec\''
|
||||||
|
\ir include/cagg_on_cagg_validations.sql
|
||||||
|
|
||||||
|
-- Cleanup
|
||||||
|
\c :TEST_DBNAME :ROLE_CLUSTER_SUPERUSER;
|
||||||
|
DROP DATABASE :DATA_NODE_1;
|
||||||
|
DROP DATABASE :DATA_NODE_2;
|
||||||
|
DROP DATABASE :DATA_NODE_3;
|
@ -7,9 +7,10 @@ CREATE MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL
|
|||||||
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket(:BUCKET_WIDTH_1ST, "time") AS bucket,
|
time_bucket(:BUCKET_WIDTH_1ST, "time") AS bucket,
|
||||||
SUM(temperature) AS temperature
|
SUM(temperature) AS temperature,
|
||||||
|
device_id
|
||||||
FROM conditions
|
FROM conditions
|
||||||
GROUP BY 1
|
GROUP BY 1,3
|
||||||
WITH NO DATA;
|
WITH NO DATA;
|
||||||
|
|
||||||
-- CAGG on CAGG (2th level)
|
-- CAGG on CAGG (2th level)
|
||||||
@ -18,8 +19,16 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
|||||||
SELECT
|
SELECT
|
||||||
time_bucket(:BUCKET_WIDTH_2TH, "bucket") AS bucket,
|
time_bucket(:BUCKET_WIDTH_2TH, "bucket") AS bucket,
|
||||||
SUM(temperature) AS temperature
|
SUM(temperature) AS temperature
|
||||||
|
\if :IS_JOIN
|
||||||
|
, :CAGG_NAME_1ST_LEVEL.device_id
|
||||||
|
FROM :CAGG_NAME_1ST_LEVEL, devices
|
||||||
|
WHERE devices.device_id = :CAGG_NAME_1ST_LEVEL.device_id
|
||||||
|
GROUP BY 1,3
|
||||||
|
\else
|
||||||
FROM :CAGG_NAME_1ST_LEVEL
|
FROM :CAGG_NAME_1ST_LEVEL
|
||||||
GROUP BY 1
|
GROUP BY 1
|
||||||
|
\endif
|
||||||
|
|
||||||
WITH NO DATA;
|
WITH NO DATA;
|
||||||
|
|
||||||
-- CAGG on CAGG (3th level)
|
-- CAGG on CAGG (3th level)
|
||||||
@ -28,8 +37,15 @@ WITH (timescaledb.continuous, timescaledb.materialized_only=true) AS
|
|||||||
SELECT
|
SELECT
|
||||||
time_bucket(:BUCKET_WIDTH_3TH, "bucket") AS bucket,
|
time_bucket(:BUCKET_WIDTH_3TH, "bucket") AS bucket,
|
||||||
SUM(temperature) AS temperature
|
SUM(temperature) AS temperature
|
||||||
|
\if :IS_JOIN
|
||||||
|
, :CAGG_NAME_2TH_LEVEL.device_id
|
||||||
|
FROM :CAGG_NAME_2TH_LEVEL, devices
|
||||||
|
WHERE devices.device_id = :CAGG_NAME_2TH_LEVEL.device_id
|
||||||
|
GROUP BY 1,3
|
||||||
|
\else
|
||||||
FROM :CAGG_NAME_2TH_LEVEL
|
FROM :CAGG_NAME_2TH_LEVEL
|
||||||
GROUP BY 1
|
GROUP BY 1
|
||||||
|
\endif
|
||||||
WITH NO DATA;
|
WITH NO DATA;
|
||||||
|
|
||||||
-- Check chunk_interval
|
-- Check chunk_interval
|
||||||
@ -60,18 +76,18 @@ WITH NO DATA;
|
|||||||
|
|
||||||
-- No data because the CAGGs are just for materialized data
|
-- No data because the CAGGs are just for materialized data
|
||||||
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
||||||
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature;
|
||||||
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
--SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
||||||
|
|
||||||
-- Turn CAGGs into Realtime
|
-- Turn CAGGs into Realtime
|
||||||
ALTER MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL SET (timescaledb.materialized_only=false);
|
ALTER MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL SET (timescaledb.materialized_only=false);
|
||||||
ALTER MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL SET (timescaledb.materialized_only=false);
|
ALTER MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL SET (timescaledb.materialized_only=false);
|
||||||
ALTER MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL SET (timescaledb.materialized_only=false);
|
--ALTER MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL SET (timescaledb.materialized_only=false);
|
||||||
|
|
||||||
-- Realtime data
|
-- Realtime data
|
||||||
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
||||||
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature;
|
||||||
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
--SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
||||||
|
|
||||||
-- Turn CAGGs into materialized only again
|
-- Turn CAGGs into materialized only again
|
||||||
ALTER MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL SET (timescaledb.materialized_only=true);
|
ALTER MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL SET (timescaledb.materialized_only=true);
|
||||||
@ -85,7 +101,7 @@ CALL refresh_continuous_aggregate(:'CAGG_NAME_3TH_LEVEL', NULL, NULL);
|
|||||||
|
|
||||||
-- Materialized data
|
-- Materialized data
|
||||||
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
||||||
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature;
|
||||||
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
||||||
|
|
||||||
\if :IS_TIME_DIMENSION
|
\if :IS_TIME_DIMENSION
|
||||||
@ -102,7 +118,7 @@ INSERT INTO conditions ("time", temperature) VALUES (10, 2);
|
|||||||
|
|
||||||
-- No changes
|
-- No changes
|
||||||
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
||||||
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature;
|
||||||
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
||||||
|
|
||||||
-- Turn CAGGs into Realtime
|
-- Turn CAGGs into Realtime
|
||||||
@ -112,7 +128,7 @@ ALTER MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL SET (timescaledb.materialized_only=
|
|||||||
|
|
||||||
-- Realtime changes, just new region
|
-- Realtime changes, just new region
|
||||||
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
||||||
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature;
|
||||||
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
||||||
|
|
||||||
-- Turn CAGGs into materialized only again
|
-- Turn CAGGs into materialized only again
|
||||||
@ -127,7 +143,7 @@ CALL refresh_continuous_aggregate(:'CAGG_NAME_3TH_LEVEL', NULL, NULL);
|
|||||||
|
|
||||||
-- All changes are materialized
|
-- All changes are materialized
|
||||||
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket;
|
||||||
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature;
|
||||||
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
||||||
|
|
||||||
-- TRUNCATE tests
|
-- TRUNCATE tests
|
||||||
@ -141,7 +157,7 @@ SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
|||||||
CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL);
|
CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL);
|
||||||
CALL refresh_continuous_aggregate(:'CAGG_NAME_3TH_LEVEL', NULL, NULL);
|
CALL refresh_continuous_aggregate(:'CAGG_NAME_3TH_LEVEL', NULL, NULL);
|
||||||
-- Now we have all the data
|
-- Now we have all the data
|
||||||
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature;
|
||||||
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket;
|
||||||
|
|
||||||
-- DROP tests
|
-- DROP tests
|
||||||
|
@ -15,15 +15,23 @@ DROP TABLE IF EXISTS conditions CASCADE;
|
|||||||
\if :IS_DEFAULT_COLUMN_ORDER
|
\if :IS_DEFAULT_COLUMN_ORDER
|
||||||
CREATE TABLE conditions (
|
CREATE TABLE conditions (
|
||||||
time :TIME_DIMENSION_DATATYPE NOT NULL,
|
time :TIME_DIMENSION_DATATYPE NOT NULL,
|
||||||
temperature NUMERIC
|
temperature NUMERIC,
|
||||||
|
device_id INT
|
||||||
);
|
);
|
||||||
\else
|
\else
|
||||||
CREATE TABLE conditions (
|
CREATE TABLE conditions (
|
||||||
temperature NUMERIC,
|
temperature NUMERIC,
|
||||||
time :TIME_DIMENSION_DATATYPE NOT NULL
|
time :TIME_DIMENSION_DATATYPE NOT NULL,
|
||||||
|
device_id INT
|
||||||
);
|
);
|
||||||
\endif
|
\endif
|
||||||
|
|
||||||
|
\if :IS_JOIN
|
||||||
|
DROP TABLE IF EXISTS devices CASCADE;
|
||||||
|
CREATE TABLE devices ( device_id int not null, name text, location text);
|
||||||
|
INSERT INTO devices values (1, 'thermo_1', 'Moscow'), (2, 'thermo_2', 'Berlin'),(3, 'thermo_3', 'London'),(4, 'thermo_4', 'Stockholm');
|
||||||
|
\endif
|
||||||
|
|
||||||
\if :IS_DISTRIBUTED
|
\if :IS_DISTRIBUTED
|
||||||
\if :IS_TIME_DIMENSION
|
\if :IS_TIME_DIMENSION
|
||||||
SELECT table_name FROM create_distributed_hypertable('conditions', 'time', replication_factor => 2);
|
SELECT table_name FROM create_distributed_hypertable('conditions', 'time', replication_factor => 2);
|
||||||
@ -39,9 +47,9 @@ DROP TABLE IF EXISTS conditions CASCADE;
|
|||||||
\endif
|
\endif
|
||||||
|
|
||||||
\if :IS_TIME_DIMENSION
|
\if :IS_TIME_DIMENSION
|
||||||
INSERT INTO conditions ("time", temperature) VALUES ('2022-01-01 00:00:00-00', 10);
|
INSERT INTO conditions ("time", temperature, device_id) VALUES ('2022-01-01 00:00:00-00', 10, 1);
|
||||||
INSERT INTO conditions ("time", temperature) VALUES ('2022-01-01 01:00:00-00', 5);
|
INSERT INTO conditions ("time", temperature, device_id) VALUES ('2022-01-01 01:00:00-00', 5, 2);
|
||||||
INSERT INTO conditions ("time", temperature) VALUES ('2022-01-02 01:00:00-00', 20);
|
INSERT INTO conditions ("time", temperature, device_id) VALUES ('2022-01-02 01:00:00-00', 20, 3);
|
||||||
\else
|
\else
|
||||||
CREATE OR REPLACE FUNCTION integer_now()
|
CREATE OR REPLACE FUNCTION integer_now()
|
||||||
RETURNS :TIME_DIMENSION_DATATYPE LANGUAGE SQL STABLE AS
|
RETURNS :TIME_DIMENSION_DATATYPE LANGUAGE SQL STABLE AS
|
||||||
@ -58,8 +66,7 @@ DROP TABLE IF EXISTS conditions CASCADE;
|
|||||||
\endif
|
\endif
|
||||||
|
|
||||||
SELECT set_integer_now_func('conditions', 'integer_now');
|
SELECT set_integer_now_func('conditions', 'integer_now');
|
||||||
|
INSERT INTO conditions ("time", temperature, device_id) VALUES (1, 10, 1);
|
||||||
INSERT INTO conditions ("time", temperature) VALUES (1, 10);
|
INSERT INTO conditions ("time", temperature, device_id) VALUES (2, 5, 2);
|
||||||
INSERT INTO conditions ("time", temperature) VALUES (2, 5);
|
INSERT INTO conditions ("time", temperature, device_id) VALUES (5, 20, 3);
|
||||||
INSERT INTO conditions ("time", temperature) VALUES (5, 20);
|
|
||||||
\endif
|
\endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user