diff --git a/scripts/test_updates_pg10.sh b/scripts/test_updates_pg10.sh index 630e8a3cd..988b4611f 100755 --- a/scripts/test_updates_pg10.sh +++ b/scripts/test_updates_pg10.sh @@ -15,7 +15,7 @@ if [ $EXIT_CODE -ne 0 ]; then fi -TAGS="1.3.0-pg10 1.3.1-pg10 1.3.2-pg10 1.4.0-pg10 1.4.1-pg10 1.4.2-pg10 1.5.0-pg10" +TAGS="1.3.0-pg10 1.3.1-pg10 1.3.2-pg10 1.4.0-pg10 1.4.1-pg10 1.4.2-pg10" TEST_VERSION="v3" TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh @@ -23,3 +23,12 @@ EXIT_CODE=$? if [ $EXIT_CODE -ne 0 ]; then exit $EXIT_CODE fi + +TAGS="1.5.0-pg10" +TEST_VERSION="v5-pg10" + +TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh +EXIT_CODE=$? +if [ $EXIT_CODE -ne 0 ]; then + exit $EXIT_CODE +fi diff --git a/scripts/test_updates_pg11.sh b/scripts/test_updates_pg11.sh index cd9941eaa..21589f85a 100755 --- a/scripts/test_updates_pg11.sh +++ b/scripts/test_updates_pg11.sh @@ -23,3 +23,12 @@ EXIT_CODE=$? if [ $EXIT_CODE -ne 0 ]; then exit $EXIT_CODE fi + +TAGS="1.5.0-pg11" +TEST_VERSION="v5-pg11" + +TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh +EXIT_CODE=$? +if [ $EXIT_CODE -ne 0 ]; then + exit $EXIT_CODE +fi diff --git a/test/sql/updates/post.compression.sql b/test/sql/updates/post.compression.sql new file mode 100644 index 000000000..101286139 --- /dev/null +++ b/test/sql/updates/post.compression.sql @@ -0,0 +1,16 @@ +-- 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 compress ORDER BY time DESC, small_cardinality; + +INSERT INTO compress +SELECT g, 'QW', g::text, 2, 0, (100,4)::custom_type_for_compression, false +FROM generate_series('2019-11-01 00:00'::timestamp, '2019-12-15 00:00'::timestamp, '1 day') g; + +SELECT count(compress_chunk(chunk.schema_name|| '.' || chunk.table_name)) as count_compressed +FROM _timescaledb_catalog.chunk chunk +INNER JOIN _timescaledb_catalog.hypertable hypertable ON (chunk.hypertable_id = hypertable.id) +WHERE hypertable.table_name = 'compress' and chunk.compressed_chunk_id IS NULL; + +SELECT * FROM compress ORDER BY time DESC, small_cardinality; diff --git a/test/sql/updates/post.v5-pg10.sql b/test/sql/updates/post.v5-pg10.sql new file mode 100644 index 000000000..4823989be --- /dev/null +++ b/test/sql/updates/post.v5-pg10.sql @@ -0,0 +1,8 @@ +-- 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. + +--skip v4 in PG10 +\ir post.v3.sql + +\ir post.compression.sql \ No newline at end of file diff --git a/test/sql/updates/post.v5-pg11.sql b/test/sql/updates/post.v5-pg11.sql new file mode 100644 index 000000000..3e1fab930 --- /dev/null +++ b/test/sql/updates/post.v5-pg11.sql @@ -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.v4.sql + +\ir post.compression.sql \ No newline at end of file diff --git a/test/sql/updates/setup.compression.sql b/test/sql/updates/setup.compression.sql new file mode 100644 index 000000000..5446c9fbc --- /dev/null +++ b/test/sql/updates/setup.compression.sql @@ -0,0 +1,37 @@ +-- 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_for_compression AS (high int, low int); + +CREATE TABLE compress ( + time TIMESTAMPTZ NOT NULL, + small_cardinality TEXT NULL, + large_cardinality TEXT NULL, + some_double DOUBLE PRECISION NULL, + some_int integer NULL, + some_custom custom_type_for_compression NULL, + some_bool boolean NULL + ); + +SELECT table_name FROM create_hypertable( 'compress', 'time'); + +INSERT INTO compress +SELECT g, 'POR', g::text, 75.0, 40, (1,2)::custom_type_for_compression, true +FROM generate_series('2018-12-01 00:00'::timestamp, '2018-12-31 00:00'::timestamp, '1 day') g; + +INSERT INTO compress +SELECT g, 'POR', NULL, NULL, NULL, NULL, NULL +FROM generate_series('2018-11-01 00:00'::timestamp, '2018-12-31 00:00'::timestamp, '1 day') g; + +INSERT INTO compress +SELECT g, 'POR', g::text, 94.0, 45, (3,4)::custom_type_for_compression, true +FROM generate_series('2018-11-01 00:00'::timestamp, '2018-12-15 00:00'::timestamp, '1 day') g; + +ALTER TABLE compress SET (timescaledb.compress, timescaledb.compress_segmentby='small_cardinality'); + +SELECT compress_chunk(chunk.schema_name|| '.' || chunk.table_name) as count_compressed +FROM _timescaledb_catalog.chunk chunk +INNER JOIN _timescaledb_catalog.hypertable hypertable ON (chunk.hypertable_id = hypertable.id) +WHERE hypertable.table_name = 'compress' and chunk.compressed_chunk_id IS NULL +ORDER BY chunk.id; \ No newline at end of file diff --git a/test/sql/updates/setup.v5-pg10.sql b/test/sql/updates/setup.v5-pg10.sql new file mode 100644 index 000000000..f68cae136 --- /dev/null +++ b/test/sql/updates/setup.v5-pg10.sql @@ -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.v4.sql + +\ir setup.compression.sql diff --git a/test/sql/updates/setup.v5-pg11.sql b/test/sql/updates/setup.v5-pg11.sql new file mode 100644 index 000000000..f68cae136 --- /dev/null +++ b/test/sql/updates/setup.v5-pg11.sql @@ -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.v4.sql + +\ir setup.compression.sql