ClickHouse/tests/queries/0_stateless/01451_detach_drop_part.sql

43 lines
1.0 KiB
MySQL
Raw Normal View History

DROP TABLE IF EXISTS mt_01451;
CREATE TABLE mt_01451 (v UInt8) ENGINE = MergeTree() order by tuple();
SYSTEM STOP MERGES mt_01451;
INSERT INTO mt_01451 VALUES (0);
INSERT INTO mt_01451 VALUES (1);
INSERT INTO mt_01451 VALUES (2);
SELECT v FROM mt_01451 ORDER BY v;
ALTER TABLE mt_01451 DETACH PART 'all_100_100_0'; -- { serverError 232 }
ALTER TABLE mt_01451 DETACH PART 'all_2_2_0';
SELECT v FROM mt_01451 ORDER BY v;
SELECT name FROM system.detached_parts WHERE table = 'mt_01451';
ALTER TABLE mt_01451 ATTACH PART 'all_2_2_0';
SELECT v FROM mt_01451 ORDER BY v;
SELECT name FROM system.detached_parts WHERE table = 'mt_01451';
SELECT '-- drop part --';
ALTER TABLE mt_01451 DROP PART 'all_4_4_0';
ALTER TABLE mt_01451 ATTACH PART 'all_4_4_0'; -- { serverError 233 }
SELECT v FROM mt_01451 ORDER BY v;
SELECT '-- resume merges --';
SYSTEM START MERGES mt_01451;
OPTIMIZE TABLE mt_01451 FINAL;
SELECT v FROM mt_01451 ORDER BY v;
SELECT name FROM system.parts WHERE table = 'mt_01451' AND active;
DROP TABLE mt_01451;