ClickHouse/tests/queries/0_stateless/01344_alter_enum_partition_key.sql

37 lines
1.8 KiB
MySQL
Raw Normal View History

2020-06-25 21:06:49 +00:00
DROP TABLE IF EXISTS test;
CREATE TABLE test (x Enum('hello' = 1, 'world' = 2), y String) ENGINE = MergeTree PARTITION BY x ORDER BY y;
INSERT INTO test VALUES ('hello', 'test');
SELECT * FROM test;
2020-06-25 23:20:47 +00:00
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
2020-06-25 21:06:49 +00:00
ALTER TABLE test MODIFY COLUMN x Enum('hello' = 1, 'world' = 2, 'goodbye' = 3);
INSERT INTO test VALUES ('goodbye', 'test');
2020-06-25 23:20:47 +00:00
OPTIMIZE TABLE test FINAL;
SELECT * FROM test ORDER BY x;
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
2020-06-26 20:40:29 +00:00
ALTER TABLE test MODIFY COLUMN x Enum('hello' = 1, 'world' = 2); -- { serverError 524 }
2020-07-21 14:05:30 +00:00
ALTER TABLE test MODIFY COLUMN x Enum('hello' = 1, 'world' = 2, 'test' = 3);
2020-06-26 20:40:29 +00:00
ALTER TABLE test MODIFY COLUMN x Enum('hello' = 1, 'world' = 2, 'goodbye' = 4); -- { serverError 524 }
2020-06-25 23:20:47 +00:00
ALTER TABLE test MODIFY COLUMN x Int8;
INSERT INTO test VALUES (111, 'abc');
OPTIMIZE TABLE test FINAL;
SELECT * FROM test ORDER BY x;
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
2020-06-25 21:06:49 +00:00
2020-06-25 23:20:47 +00:00
ALTER TABLE test MODIFY COLUMN x Enum8('' = 1); -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x Enum16('' = 1); -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x UInt64; -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x String; -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x Nullable(Int64); -- { serverError 524 }
2020-06-25 21:06:49 +00:00
2020-07-09 19:14:19 +00:00
ALTER TABLE test RENAME COLUMN x TO z; -- { serverError 524 }
ALTER TABLE test RENAME COLUMN y TO z; -- { serverError 524 }
2020-06-25 23:37:24 +00:00
ALTER TABLE test DROP COLUMN x; -- { serverError 47 }
ALTER TABLE test DROP COLUMN y; -- { serverError 47 }
2020-06-25 21:06:49 +00:00
DROP TABLE test;