mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Merge pull request #1984 from zhang2014/fix/subquery_in_create
Fix exist subquery when create materializer view
This commit is contained in:
commit
7e139866d2
@ -44,9 +44,14 @@ static void extractDependentTable(const ASTSelectQuery & query, String & select_
|
||||
select_database_name = typeid_cast<const ASTIdentifier &>(*query_database).name;
|
||||
select_table_name = ast_id->name;
|
||||
}
|
||||
else if (auto ast_select = typeid_cast<const ASTSelectQuery *>(query_table.get()))
|
||||
else if (auto ast_select = typeid_cast<const ASTSelectWithUnionQuery *>(query_table.get()))
|
||||
{
|
||||
extractDependentTable(*ast_select, select_database_name, select_table_name);
|
||||
if (ast_select->list_of_selects->children.size() != 1)
|
||||
throw Exception("UNION is not supported for MATERIALIZED VIEW", ErrorCodes::INCORRECT_QUERY);
|
||||
|
||||
auto inner_query = ast_select->list_of_selects->children.at(0);
|
||||
|
||||
extractDependentTable(typeid_cast<const ASTSelectQuery &>(*inner_query), select_database_name, select_table_name);
|
||||
}
|
||||
else
|
||||
throw Exception("Logical error while creating StorageMaterializedView."
|
||||
|
Loading…
Reference in New Issue
Block a user