ClickHouse/tests/queries/0_stateless/00687_insert_into_mv.sql

32 lines
822 B
MySQL
Raw Normal View History

2019-06-03 17:36:27 +00:00
DROP TABLE IF EXISTS test_00687;
DROP TABLE IF EXISTS mv_bad;
DROP TABLE IF EXISTS mv_good;
DROP TABLE IF EXISTS mv_group;
2018-08-08 03:09:59 +00:00
2019-06-03 17:36:27 +00:00
CREATE TABLE test_00687 (x String) ENGINE = Null;
2018-08-08 03:09:59 +00:00
create MATERIALIZED VIEW mv_bad (x String)
2018-08-08 03:09:59 +00:00
ENGINE = MergeTree Partition by tuple() order by tuple()
2019-06-03 17:36:27 +00:00
AS SELECT DISTINCT x FROM test_00687;
2018-08-08 03:09:59 +00:00
create MATERIALIZED VIEW mv_good (x String)
2018-08-08 03:09:59 +00:00
ENGINE = MergeTree Partition by tuple() order by tuple()
2019-06-03 17:36:27 +00:00
AS SELECT x FROM test_00687;
2018-08-08 03:09:59 +00:00
create MATERIALIZED VIEW mv_group (x String)
2018-08-08 03:09:59 +00:00
ENGINE = MergeTree Partition by tuple() order by tuple()
2019-06-03 17:36:27 +00:00
AS SELECT x FROM test_00687 group by x;
2018-08-08 03:09:59 +00:00
2019-06-03 17:36:27 +00:00
insert into test_00687 values ('stest'), ('stest');
2018-08-08 03:09:59 +00:00
select * from mv_bad;
2018-08-08 03:09:59 +00:00
SELECT '---';
select * from mv_good;
2018-08-08 03:09:59 +00:00
SELECT '---';
select * from mv_group;
2018-08-08 03:09:59 +00:00
DROP TABLE mv_bad;
DROP TABLE mv_good;
DROP TABLE mv_group;
2019-06-03 17:36:27 +00:00
DROP TABLE test_00687;