mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 02:53:51 +08:00
Test continuous aggs with extension updates
Add a v3 update test that makes sure that continuous aggregates continue to work after extensions are updated.
This commit is contained in:
parent
37cdd7f45b
commit
33d28d2217
@ -5,7 +5,21 @@ set -o pipefail
|
||||
|
||||
SCRIPT_DIR=$(dirname $0)
|
||||
|
||||
TAGS="0.7.0-pg10 0.7.1-pg10 0.8.0-pg10 0.9.0-pg10 0.9.1-pg10 0.9.2-pg10 0.10.0-pg10 0.10.1-pg10 0.11.0-pg10 0.12.0-pg10 1.0.0-pg10 1.0.1-pg10 1.1.0-pg10 1.1.1-pg10 1.2.0-pg10 1.2.1-pg10 1.2.2-pg10 1.3.0-pg10 1.3.1-pg10"
|
||||
TAGS="0.7.0-pg10 0.7.1-pg10 0.8.0-pg10 0.9.0-pg10 0.9.1-pg10 0.9.2-pg10 0.10.0-pg10 0.10.1-pg10 0.11.0-pg10 0.12.0-pg10 1.0.0-pg10 1.0.1-pg10 1.1.0-pg10 1.1.1-pg10 1.2.0-pg10 1.2.1-pg10 1.2.2-pg10"
|
||||
TEST_VERSION="v2"
|
||||
|
||||
. ${SCRIPT_DIR}/test_updates.sh
|
||||
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
||||
|
||||
TAGS="1.3.0-pg10 1.3.1-pg10"
|
||||
TEST_VERSION="v3"
|
||||
|
||||
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
@ -12,7 +12,20 @@ set -o pipefail
|
||||
|
||||
SCRIPT_DIR=$(dirname $0)
|
||||
|
||||
TAGS="0.5.0 0.6.0 0.6.1 0.7.0-pg9.6 0.7.1-pg9.6 0.8.0-pg9.6 0.9.0-pg9.6 0.9.1-pg9.6 0.9.2-pg9.6 0.10.0-pg9.6 0.10.1-pg9.6 0.11.0-pg9.6 0.12.0-pg9.6 1.0.0-pg9.6 1.0.1-pg9.6 1.1.0-pg9.6 1.1.1-pg9.6 1.2.0-pg9.6 1.2.1-pg9.6 1.2.2-pg9.6 1.3.0-pg9.6 1.3.1-pg9.6"
|
||||
TAGS="0.5.0 0.6.0 0.6.1 0.7.0-pg9.6 0.7.1-pg9.6 0.8.0-pg9.6 0.9.0-pg9.6 0.9.1-pg9.6 0.9.2-pg9.6 0.10.0-pg9.6 0.10.1-pg9.6 0.11.0-pg9.6 0.12.0-pg9.6 1.0.0-pg9.6 1.0.1-pg9.6 1.1.0-pg9.6 1.1.1-pg9.6 1.2.0-pg9.6 1.2.1-pg9.6 1.2.2-pg9.6"
|
||||
TEST_VERSION="v2"
|
||||
|
||||
. ${SCRIPT_DIR}/test_updates.sh
|
||||
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
||||
TAGS="1.3.0-pg9.6 1.3.1-pg9.6"
|
||||
TEST_VERSION="v3"
|
||||
|
||||
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
15
test/sql/updates/post.continuous_aggs.sql
Normal file
15
test/sql/updates/post.continuous_aggs.sql
Normal file
@ -0,0 +1,15 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
SELECT * FROM mat_before;
|
||||
|
||||
INSERT INTO conditions_before
|
||||
SELECT generate_series('2018-12-01 00:00'::timestamp, '2018-12-31 00:00'::timestamp, '1 day'), 'POR', 165, 75, 40, 70, NULL, (1,2)::custom_type, 2, true;
|
||||
|
||||
SELECT * FROM mat_before;
|
||||
|
||||
REFRESH MATERIALIZED VIEW mat_before;
|
||||
|
||||
--the max of the temp for the POR should now be 165
|
||||
SELECT * FROM mat_before;
|
7
test/sql/updates/post.v3.sql
Normal file
7
test/sql/updates/post.v3.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
\ir post.v2.sql
|
||||
|
||||
\ir post.continuous_aggs.sql
|
73
test/sql/updates/setup.continuous_aggs.sql
Normal file
73
test/sql/updates/setup.continuous_aggs.sql
Normal file
@ -0,0 +1,73 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
CREATE TYPE custom_type AS (high int, low int);
|
||||
|
||||
CREATE TABLE conditions_before (
|
||||
timec TIMESTAMPTZ NOT NULL,
|
||||
location TEXT NOT NULL,
|
||||
temperature DOUBLE PRECISION NULL,
|
||||
humidity DOUBLE PRECISION NULL,
|
||||
lowp double precision NULL,
|
||||
highp double precision null,
|
||||
allnull double precision null,
|
||||
highlow custom_type null,
|
||||
bit_int smallint,
|
||||
good_life boolean
|
||||
);
|
||||
|
||||
SELECT table_name FROM create_hypertable( 'conditions_before', 'timec');
|
||||
|
||||
INSERT INTO conditions_before
|
||||
SELECT generate_series('2018-12-01 00:00'::timestamp, '2018-12-31 00:00'::timestamp, '1 day'), 'POR', 55, 75, 40, 70, NULL, (1,2)::custom_type, 2, true;
|
||||
INSERT INTO conditions_before
|
||||
SELECT generate_series('2018-11-01 00:00'::timestamp, '2018-12-31 00:00'::timestamp, '1 day'), 'NYC', 35, 45, 50, 40, NULL, (3,4)::custom_type, 4, false;
|
||||
INSERT INTO conditions_before
|
||||
SELECT generate_series('2018-11-01 00:00'::timestamp, '2018-12-15 00:00'::timestamp, '1 day'), 'LA', 73, 55, NULL, 28, NULL, NULL, 8, true;
|
||||
|
||||
CREATE VIEW mat_before
|
||||
WITH ( timescaledb.continuous, timescaledb.refresh_lag='-30 day')
|
||||
AS
|
||||
SELECT time_bucket('1week', timec) as bucket,
|
||||
location,
|
||||
min(allnull) as min_allnull,
|
||||
max(temperature) as max_temp,
|
||||
sum(temperature)+sum(humidity) as agg_sum_expr,
|
||||
avg(humidity),
|
||||
stddev(humidity),
|
||||
bit_and(bit_int),
|
||||
bit_or(bit_int),
|
||||
bool_and(good_life),
|
||||
every(temperature > 0),
|
||||
bool_or(good_life),
|
||||
count(*) as count_rows,
|
||||
count(temperature) as count_temp,
|
||||
count(allnull) as count_zero,
|
||||
corr(temperature, humidity),
|
||||
covar_pop(temperature, humidity),
|
||||
covar_samp(temperature, humidity),
|
||||
regr_avgx(temperature, humidity),
|
||||
regr_avgy(temperature, humidity),
|
||||
regr_count(temperature, humidity),
|
||||
regr_intercept(temperature, humidity),
|
||||
regr_r2(temperature, humidity),
|
||||
regr_slope(temperature, humidity),
|
||||
regr_sxx(temperature, humidity),
|
||||
regr_sxy(temperature, humidity),
|
||||
regr_syy(temperature, humidity),
|
||||
stddev(temperature) as stddev_temp,
|
||||
stddev_pop(temperature),
|
||||
stddev_samp(temperature),
|
||||
variance(temperature),
|
||||
var_pop(temperature),
|
||||
var_samp(temperature),
|
||||
last(temperature, timec) as last_temp,
|
||||
last(highlow, timec) as last_hl,
|
||||
first(highlow, timec) as first_hl,
|
||||
histogram(temperature, 0, 100, 5)
|
||||
FROM conditions_before
|
||||
GROUP BY bucket, location
|
||||
HAVING min(location) >= 'NYC' and avg(temperature) > 2;
|
||||
|
||||
REFRESH MATERIALIZED VIEW mat_before;
|
7
test/sql/updates/setup.v3.sql
Normal file
7
test/sql/updates/setup.v3.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
\ir setup.v2.sql
|
||||
|
||||
\ir setup.continuous_aggs.sql
|
Loading…
x
Reference in New Issue
Block a user