|
| 1 | +-- This file and its contents are licensed under the Timescale License. |
| 2 | +-- Please see the included NOTICE for copyright information and |
| 3 | +-- LICENSE-TIMESCALE for a copy of the license. |
| 4 | +-- This test is to verify fixing the behaviour reported in: SDC #2912 |
| 5 | +-- Create destination database |
| 6 | +\set TEST_DBNAME_3 :TEST_DBNAME _3 |
| 7 | +\c postgres :ROLE_SUPERUSER |
| 8 | +CREATE DATABASE :TEST_DBNAME_3; |
| 9 | +\c :TEST_DBNAME_3 :ROLE_SUPERUSER |
| 10 | +create extension timescaledb CASCADE; |
| 11 | +-- Create source database |
| 12 | +\set TEST_DBNAME_2 :TEST_DBNAME _2 |
| 13 | +\c postgres :ROLE_SUPERUSER |
| 14 | +CREATE DATABASE :TEST_DBNAME_2; |
| 15 | +\c :TEST_DBNAME_2 :ROLE_SUPERUSER |
| 16 | +create extension timescaledb CASCADE; |
| 17 | +-- Create compressed table with one column having all NULL |
| 18 | +-- values, so it will be compressed with the NULL algorithm |
| 19 | +-- |
| 20 | +create table null_dump (ts int primary key, n int); |
| 21 | +select create_hypertable('null_dump', 'ts'); |
| 22 | + create_hypertable |
| 23 | +------------------------ |
| 24 | + (1,public,null_dump,t) |
| 25 | +(1 row) |
| 26 | + |
| 27 | +insert into null_dump values (1), (2), (3), (4); |
| 28 | +alter table null_dump set (timescaledb.compress, timescaledb.compress_orderby = 'ts'); |
| 29 | +select compress_chunk(show_chunks('null_dump')); |
| 30 | + compress_chunk |
| 31 | +---------------------------------------- |
| 32 | + _timescaledb_internal._hyper_1_1_chunk |
| 33 | +(1 row) |
| 34 | + |
| 35 | +-- Dump the content of the source database |
| 36 | +\setenv TEST_DBNAME :TEST_DBNAME_2 |
| 37 | +\setenv DUMP_OPTIONS '--quote-all-identifiers --no-tablespaces --no-owner --no-privileges --exclude-schema=test' |
| 38 | +\c postgres :ROLE_SUPERUSER |
| 39 | +\! utils/pg_dump_aux_plain_dump.sh dump/null-compress-dump.sql |
| 40 | +--quote-all-identifiers --no-tablespaces --no-owner --no-privileges --exclude-schema=test |
| 41 | +--quote-all-identifiers --no-tablespaces --no-owner --no-privileges --exclude-schema=test |
| 42 | +--quote-all-identifiers --no-tablespaces --no-owner --no-privileges --exclude-schema=test |
| 43 | +pg_dump: warning: there are circular foreign-key constraints on this table: |
| 44 | +pg_dump: detail: hypertable |
| 45 | +pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints. |
| 46 | +pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem. |
| 47 | +pg_dump: warning: there are circular foreign-key constraints on this table: |
| 48 | +pg_dump: detail: chunk |
| 49 | +pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints. |
| 50 | +pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem. |
| 51 | +pg_dump: warning: there are circular foreign-key constraints on this table: |
| 52 | +pg_dump: detail: continuous_agg |
| 53 | +pg_dump: hint: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints. |
| 54 | +pg_dump: hint: Consider using a full dump instead of a --data-only dump to avoid this problem. |
| 55 | +-- Restore the data into the destination database |
| 56 | +\c :TEST_DBNAME_3 :ROLE_SUPERUSER |
| 57 | +select public.timescaledb_pre_restore(); |
| 58 | + timescaledb_pre_restore |
| 59 | +------------------------- |
| 60 | + t |
| 61 | +(1 row) |
| 62 | + |
| 63 | +\set ECHO none |
| 64 | +select public.timescaledb_post_restore(); |
| 65 | + timescaledb_post_restore |
| 66 | +-------------------------- |
| 67 | + t |
| 68 | +(1 row) |
| 69 | + |
| 70 | +select * from public.null_dump order by 1; |
| 71 | + ts | n |
| 72 | +----+--- |
| 73 | + 1 | |
| 74 | + 2 | |
| 75 | + 3 | |
| 76 | + 4 | |
| 77 | +(4 rows) |
| 78 | + |
| 79 | +drop database db_compression_null_dump_restore_2; |
| 80 | +drop database db_compression_null_dump_restore_3; |
0 commit comments