ClickHouse/dbms/tests/queries/0_stateless/00942_mv_rename_table.sql
2019-06-07 18:41:24 +03:00

20 lines
529 B
SQL

DROP TABLE IF EXISTS src;
DROP TABLE IF EXISTS view_table;
DROP TABLE IF EXISTS new_view_table;
CREATE TABLE src (x UInt8) ENGINE = Null;
CREATE MATERIALIZED VIEW view_table Engine = Memory AS SELECT * FROM src;
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
RENAME TABLE view_table TO new_view_table;
SELECT * FROM new_view_table ORDER BY x;
DROP TABLE src;
DROP TABLE IF EXISTS view_table;
DROP TABLE IF EXISTS new_view_table;