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

32 lines
780 B
MySQL
Raw Normal View History

DROP TABLE IF EXISTS test;
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
CREATE TABLE test (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()
AS SELECT DISTINCT x FROM test;
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()
AS SELECT x FROM test;
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()
AS SELECT x FROM test group by x;
2018-08-08 03:09:59 +00:00
insert into test 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;
DROP TABLE test;