diff --git a/tests/queries/0_stateless/01901_test_attach_partition_from.reference b/tests/queries/0_stateless/01901_test_attach_partition_from.reference new file mode 100644 index 00000000000..be589c9ceb0 --- /dev/null +++ b/tests/queries/0_stateless/01901_test_attach_partition_from.reference @@ -0,0 +1,4 @@ +1 +1 +2 +2 diff --git a/tests/queries/0_stateless/01901_test_attach_partition_from.sql b/tests/queries/0_stateless/01901_test_attach_partition_from.sql new file mode 100644 index 00000000000..0948c105990 --- /dev/null +++ b/tests/queries/0_stateless/01901_test_attach_partition_from.sql @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS test_alter_attach_01901S; +DROP TABLE IF EXISTS test_alter_attach_01901D; + +CREATE TABLE test_alter_attach_01901S (A Int64, D date) ENGINE = MergeTree partition by D order by A; +insert into test_alter_attach_01901S values(1, '2020-01-01'); + +create table test_alter_attach_01901D (A Int64, D date) +Engine=ReplicatedMergeTree('/clickhouse/tables/test_alter_attach_01901D', 'r1') +partition by D order by A; + +alter table test_alter_attach_01901D attach partition '2020-01-01' from test_alter_attach_01901S; + +select count() from test_alter_attach_01901D; +select count() from test_alter_attach_01901S; + +insert into test_alter_attach_01901S values(1, '2020-01-01'); +alter table test_alter_attach_01901D replace partition '2020-01-01' from test_alter_attach_01901S; + +select count() from test_alter_attach_01901D; +select count() from test_alter_attach_01901S; + + +DROP TABLE test_alter_attach_01901S; +DROP TABLE test_alter_attach_01901D; + + +