Merge pull request #14664 from ClickHouse/fix_missed_database_when_altering_mv

Fix missed database name when altering MaterializedView
This commit is contained in:
tavplubix 2020-09-10 17:55:31 +03:00 committed by GitHub
commit a6c9dd0465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<ASTSelectQuery &>();
auto & new_inner_query = new_select.list_of_selects->children.at(0);
auto & select_query = new_inner_query->as<ASTSelectQuery &>();
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;
}