ClickHouse/dbms/tests/queries/0_stateless/00942_mv_rename_table.sql
Alexander Kuzmenkov be331e3e9c Make table names in some stateless tests unique.
Hoping this fixes strange failures we've been seeing under MemorySanitizer.
2020-03-30 15:59:01 +03:00

20 lines
613 B
SQL

DROP TABLE IF EXISTS src_00942;
DROP TABLE IF EXISTS view_table_00942;
DROP TABLE IF EXISTS new_view_table_00942;
CREATE TABLE src_00942 (x UInt8) ENGINE = Null;
CREATE MATERIALIZED VIEW view_table_00942 Engine = Memory AS SELECT * FROM src_00942;
INSERT INTO src_00942 VALUES (1), (2), (3);
SELECT * FROM view_table_00942 ORDER BY x;
--Check if we can rename the view and if we can still fetch datas
RENAME TABLE view_table_00942 TO new_view_table_00942;
SELECT * FROM new_view_table_00942 ORDER BY x;
DROP TABLE src_00942;
DROP TABLE IF EXISTS view_table_00942;
DROP TABLE IF EXISTS new_view_table_00942;