2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS cast_enums;
|
2022-06-23 08:37:52 +00:00
|
|
|
set allow_deprecated_syntax_for_merge_tree=1;
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE cast_enums
|
2017-04-24 10:04:51 +00:00
|
|
|
(
|
|
|
|
type Enum8('session' = 1, 'pageview' = 2, 'click' = 3),
|
|
|
|
date Date,
|
|
|
|
id UInt64
|
|
|
|
) ENGINE = MergeTree(date, (type, date, id), 8192);
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO cast_enums SELECT 'session' AS type, toDate('2017-01-01') AS date, number AS id FROM system.numbers LIMIT 2;
|
|
|
|
INSERT INTO cast_enums SELECT 2 AS type, toDate('2017-01-01') AS date, number AS id FROM system.numbers LIMIT 2;
|
2017-04-24 10:04:51 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT type, date, id FROM cast_enums ORDER BY type, id;
|
2017-04-24 10:04:51 +00:00
|
|
|
|
2024-05-31 08:44:16 +00:00
|
|
|
INSERT INTO cast_enums VALUES ('wrong_value', '2017-01-02', 7); -- { clientError UNKNOWN_ELEMENT_OF_ENUM }
|
2020-01-29 14:15:53 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS cast_enums;
|