2019-04-18 18:48:04 +00:00
|
|
|
DROP TABLE IF EXISTS test.cast1;
|
|
|
|
DROP TABLE IF EXISTS test.cast2;
|
2018-06-07 20:49:59 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
CREATE TABLE test.cast1
|
2018-06-07 20:49:59 +00:00
|
|
|
(
|
|
|
|
x UInt8,
|
|
|
|
e Enum8
|
|
|
|
(
|
|
|
|
'hello' = 1,
|
|
|
|
'world' = 2
|
|
|
|
)
|
|
|
|
DEFAULT
|
|
|
|
CAST
|
|
|
|
(
|
|
|
|
x
|
|
|
|
AS
|
|
|
|
Enum8
|
|
|
|
(
|
|
|
|
'hello' = 1,
|
|
|
|
'world' = 2
|
|
|
|
)
|
|
|
|
)
|
|
|
|
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_cast', 'r1') ORDER BY e;
|
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
SHOW CREATE TABLE test.cast1 FORMAT TSVRaw;
|
|
|
|
DESC TABLE test.cast1;
|
2018-06-07 20:49:59 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
INSERT INTO test.cast1 (x) VALUES (1);
|
|
|
|
SELECT * FROM test.cast1;
|
2018-06-07 20:49:59 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
CREATE TABLE test.cast2 AS test.cast1 ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_cast', 'r2') ORDER BY e;
|
2018-06-07 20:49:59 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
SYSTEM SYNC REPLICA test.cast2;
|
2018-06-07 20:49:59 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
SELECT * FROM test.cast2;
|
2018-06-07 20:49:59 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
DROP TABLE test.cast1;
|
|
|
|
DROP TABLE test.cast2;
|