From 7080d56470a9bfed57dde63ef2e40c9832599c72 Mon Sep 17 00:00:00 2001 From: Alexander Tokmakov Date: Wed, 9 Sep 2020 22:59:34 +0300 Subject: [PATCH] fix missed database name when altering mv --- src/Storages/SelectQueryDescription.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Storages/SelectQueryDescription.cpp b/src/Storages/SelectQueryDescription.cpp index bb8295df6f3..0935a5be5ca 100644 --- a/src/Storages/SelectQueryDescription.cpp +++ b/src/Storages/SelectQueryDescription.cpp @@ -105,14 +105,14 @@ SelectQueryDescription SelectQueryDescription::getSelectQueryFromASTForMatView(c if (new_select.list_of_selects->children.size() != 1) throw Exception("UNION is not supported for MATERIALIZED VIEW", ErrorCodes::QUERY_IS_NOT_SUPPORTED_IN_MATERIALIZED_VIEW); - SelectQueryDescription result; - - result.inner_query = new_select.list_of_selects->children.at(0)->clone(); - - auto & select_query = result.inner_query->as(); + auto & new_inner_query = new_select.list_of_selects->children.at(0); + auto & select_query = new_inner_query->as(); checkAllowedQueries(select_query); + + SelectQueryDescription result; result.select_table_id = extractDependentTableFromSelectQuery(select_query, context); - result.select_query = select->clone(); + result.select_query = new_select.clone(); + result.inner_query = new_inner_query->clone(); return result; }