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-05-07 06:54:55 +00:00
|
|
|
|
2019-06-07 15:41:24 +00:00
|
|
|
CREATE TABLE src (x UInt8) ENGINE = Null;
|
2019-05-07 06:54:55 +00:00
|
|
|
|
2019-06-07 15:41:24 +00:00
|
|
|
CREATE MATERIALIZED VIEW view_table Engine = Memory AS SELECT * FROM src;
|
2019-05-07 06:54:55 +00:00
|
|
|
|
2019-06-07 15:41:24 +00:00
|
|
|
INSERT INTO src VALUES (1), (2), (3);
|
|
|
|
SELECT * FROM view_table ORDER BY x;
|
2019-05-07 06:54:55 +00:00
|
|
|
|
|
|
|
--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-05-07 06:54:55 +00:00
|
|
|
|
2019-06-07 15:41:24 +00:00
|
|
|
DROP TABLE src;
|
|
|
|
DROP TABLE IF EXISTS view_table;
|
|
|
|
DROP TABLE IF EXISTS new_view_table;
|