ClickHouse/dbms/tests/queries/0_stateless/00942_mv_rename_table.sql

20 lines
529 B
MySQL
Raw Normal View History

2019-06-07 15:41:24 +00:00
DROP TABLE IF EXISTS src;
DROP TABLE IF EXISTS view_table;
DROP TABLE IF EXISTS new_view_table;
2019-06-07 15:41:24 +00:00
CREATE TABLE src (x UInt8) ENGINE = Null;
2019-06-07 15:41:24 +00:00
CREATE MATERIALIZED VIEW view_table Engine = Memory AS SELECT * FROM src;
2019-06-07 15:41:24 +00:00
INSERT INTO src VALUES (1), (2), (3);
SELECT * FROM view_table ORDER BY x;
--Check if we can rename the view and if we can still fetch datas
2019-06-07 15:41:24 +00:00
RENAME TABLE view_table TO new_view_table;
SELECT * FROM new_view_table ORDER BY x;
2019-06-07 15:41:24 +00:00
DROP TABLE src;
DROP TABLE IF EXISTS view_table;
DROP TABLE IF EXISTS new_view_table;