diff --git a/dbms/src/Interpreters/InterpreterSelectQuery.cpp b/dbms/src/Interpreters/InterpreterSelectQuery.cpp index 468cbbd605b..deab0d69127 100644 --- a/dbms/src/Interpreters/InterpreterSelectQuery.cpp +++ b/dbms/src/Interpreters/InterpreterSelectQuery.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/dbms/src/Storages/StorageView.cpp b/dbms/src/Storages/StorageView.cpp index 763023dd347..7b0c9a56f63 100644 --- a/dbms/src/Storages/StorageView.cpp +++ b/dbms/src/Storages/StorageView.cpp @@ -80,6 +80,8 @@ BlockInputStreams StorageView::read( const size_t max_block_size, const unsigned threads) { + processed_stage = QueryProcessingStage::FetchColumns; + ASTPtr inner_query_clone = getInnerQuery(); ASTSelectQuery & inner_select = static_cast(*inner_query_clone); const ASTSelectQuery & outer_select = typeid_cast(*query); diff --git a/dbms/tests/queries/0_stateless/00270_views_query_processing_stage.reference b/dbms/tests/queries/0_stateless/00270_views_query_processing_stage.reference new file mode 100644 index 00000000000..5c4a24b0e17 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00270_views_query_processing_stage.reference @@ -0,0 +1,5 @@ +Hello, world! +Hello, world! +Hello, world! +Hello, world! +Hello, world! diff --git a/dbms/tests/queries/0_stateless/00270_views_query_processing_stage.sql b/dbms/tests/queries/0_stateless/00270_views_query_processing_stage.sql new file mode 100644 index 00000000000..29d464a8fbd --- /dev/null +++ b/dbms/tests/queries/0_stateless/00270_views_query_processing_stage.sql @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS test.view1; +DROP TABLE IF EXISTS test.view2; +DROP TABLE IF EXISTS test.merge_view; + +CREATE VIEW test.view1 AS SELECT number FROM system.numbers LIMIT 10; +CREATE VIEW test.view2 AS SELECT number FROM system.numbers LIMIT 10; +CREATE TABLE test.merge_view (number UInt64) ENGINE = Merge(test, '^view'); + +SELECT 'Hello, world!' FROM merge_view LIMIT 5; + +DROP TABLE test.view1; +DROP TABLE test.view2; +DROP TABLE test.merge_view;