mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
24 lines
787 B
SQL
24 lines
787 B
SQL
-- Tags: no-replicated-database, no-parallel
|
|
-- Tag no-replicated-database: Unsupported type of ALTER query
|
|
|
|
DROP TABLE IF EXISTS alter_attach;
|
|
CREATE TABLE alter_attach (x UInt64, p UInt8) ENGINE = MergeTree ORDER BY tuple() PARTITION BY p;
|
|
INSERT INTO alter_attach VALUES (1, 1), (2, 1), (3, 1);
|
|
|
|
ALTER TABLE alter_attach DETACH PARTITION 1;
|
|
|
|
ALTER TABLE alter_attach ADD COLUMN s String;
|
|
INSERT INTO alter_attach VALUES (4, 2, 'Hello'), (5, 2, 'World');
|
|
|
|
ALTER TABLE alter_attach ATTACH PARTITION 1;
|
|
SELECT * FROM alter_attach ORDER BY x;
|
|
|
|
ALTER TABLE alter_attach DETACH PARTITION 2;
|
|
ALTER TABLE alter_attach DROP COLUMN s;
|
|
INSERT INTO alter_attach VALUES (6, 3), (7, 3);
|
|
|
|
ALTER TABLE alter_attach ATTACH PARTITION 2;
|
|
SELECT * FROM alter_attach ORDER BY x;
|
|
|
|
DROP TABLE alter_attach;
|