From addce5c1327b154839e1fd55faed67742c7d4fe2 Mon Sep 17 00:00:00 2001 From: zhongyuankai Date: Sat, 28 Aug 2021 12:33:35 +0800 Subject: [PATCH] fix system views test --- .../0_stateless/02015_add_system_views.reference | 1 - .../queries/0_stateless/02015_add_system_views.sql | 8 -------- .../0_stateless/02015_system_views.reference | 1 + tests/queries/0_stateless/02015_system_views.sql | 14 ++++++++++++++ 4 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 tests/queries/0_stateless/02015_add_system_views.reference delete mode 100644 tests/queries/0_stateless/02015_add_system_views.sql create mode 100644 tests/queries/0_stateless/02015_system_views.reference create mode 100644 tests/queries/0_stateless/02015_system_views.sql diff --git a/tests/queries/0_stateless/02015_add_system_views.reference b/tests/queries/0_stateless/02015_add_system_views.reference deleted file mode 100644 index 3dd3295e43f..00000000000 --- a/tests/queries/0_stateless/02015_add_system_views.reference +++ /dev/null @@ -1 +0,0 @@ -default views_test_view default views_test Materialized diff --git a/tests/queries/0_stateless/02015_add_system_views.sql b/tests/queries/0_stateless/02015_add_system_views.sql deleted file mode 100644 index 933f77f58d2..00000000000 --- a/tests/queries/0_stateless/02015_add_system_views.sql +++ /dev/null @@ -1,8 +0,0 @@ -DROP TABLE IF EXISTS views_test; -CREATE TABLE views_test (a UInt8, s String) ENGINE = MergeTree() ORDER BY a; -DROP TABLE IF EXISTS views_test_view; -CREATE MATERIALIZED VIEW views_test_view ENGINE = ReplacingMergeTree() ORDER BY a AS SELECT * FROM views_test; -SELECT * FROM system.views WHERE name = 'views_test_view'; -DROP TABLE IF EXISTS views_test_view; -SELECT * FROM system.views WHERE name = 'views_test_view'; -DROP TABLE IF EXISTS views_test; diff --git a/tests/queries/0_stateless/02015_system_views.reference b/tests/queries/0_stateless/02015_system_views.reference new file mode 100644 index 00000000000..a1b1b2a9fd3 --- /dev/null +++ b/tests/queries/0_stateless/02015_system_views.reference @@ -0,0 +1 @@ +02015_db materialized_view 02015_db view_source_tb Materialized diff --git a/tests/queries/0_stateless/02015_system_views.sql b/tests/queries/0_stateless/02015_system_views.sql new file mode 100644 index 00000000000..a6375dcb591 --- /dev/null +++ b/tests/queries/0_stateless/02015_system_views.sql @@ -0,0 +1,14 @@ +DROP DATABASE IF EXISTS 02015_db; +CREATE DATABASE IF NOT EXISTS 02015_db; + +DROP TABLE IF EXISTS 02015_db.view_source_tb; +CREATE TABLE IF NOT EXISTS 02015_db.view_source_tb (a UInt8, s String) ENGINE = MergeTree() ORDER BY a; + +DROP TABLE IF EXISTS 02015_db.materialized_view; +CREATE MATERIALIZED VIEW IF NOT EXISTS 02015_db.materialized_view ENGINE = ReplacingMergeTree() ORDER BY a AS SELECT * FROM 02015_db.view_source_tb; + +SELECT * FROM system.views WHERE database='02015_db' and name = 'materialized_view'; + +DROP TABLE IF EXISTS 02015_db.materialized_view; +DROP TABLE IF EXISTS 02015_db.view_source_tb; +DROP DATABASE IF EXISTS 02015_db;