mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #70623 from ClickHouse/backport/24.8/70264
Backport #70264 to 24.8: Fix segfault on creating materialized view with intersect
This commit is contained in:
commit
4bdf94f150
@ -100,17 +100,20 @@ void checkAllowedQueries(const ASTSelectQuery & query)
|
||||
/// check if only one single select query in SelectWithUnionQuery
|
||||
static bool isSingleSelect(const ASTPtr & select, ASTPtr & res)
|
||||
{
|
||||
auto new_select = select->as<ASTSelectWithUnionQuery &>();
|
||||
if (new_select.list_of_selects->children.size() != 1)
|
||||
auto * new_select = select->as<ASTSelectWithUnionQuery>();
|
||||
if (new_select == nullptr)
|
||||
return false;
|
||||
auto & new_inner_query = new_select.list_of_selects->children.at(0);
|
||||
|
||||
if (new_select->list_of_selects->children.size() != 1)
|
||||
return false;
|
||||
auto & new_inner_query = new_select->list_of_selects->children.at(0);
|
||||
if (new_inner_query->as<ASTSelectQuery>())
|
||||
{
|
||||
res = new_inner_query;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return isSingleSelect(new_inner_query, res);
|
||||
|
||||
return isSingleSelect(new_inner_query, res);
|
||||
}
|
||||
|
||||
SelectQueryDescription SelectQueryDescription::getSelectQueryFromASTForMatView(const ASTPtr & select, bool refreshable, ContextPtr context)
|
||||
|
@ -0,0 +1 @@
|
||||
CREATE MATERIALIZED VIEW v0 AS (SELECT 1) INTERSECT (SELECT 1); --{serverError QUERY_IS_NOT_SUPPORTED_IN_MATERIALIZED_VIEW}
|
Loading…
Reference in New Issue
Block a user