Skip to content

Commit b53fc06

Browse files
committed
Fix SYSTEM DROP FILESYSTEM CACHE 'cache' ON CLUSTER 'cluster'
1 parent 6c60493 commit b53fc06

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Parsers/ASTSystemQuery.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,13 @@ void ASTSystemQuery::formatImpl(WriteBuffer & ostr, const FormatSettings & setti
163163

164164
print_keyword("SYSTEM") << " ";
165165
print_keyword(typeToString(type));
166-
if (!cluster.empty())
166+
167+
std::unordered_set<Type> queries_with_on_cluster_at_end = {
168+
Type::DROP_FILESYSTEM_CACHE,
169+
Type::SYNC_FILESYSTEM_CACHE,
170+
};
171+
172+
if (!queries_with_on_cluster_at_end.contains(type) && !cluster.empty())
167173
formatOnCluster(ostr, settings);
168174

169175
switch (type)
@@ -519,6 +525,9 @@ void ASTSystemQuery::formatImpl(WriteBuffer & ostr, const FormatSettings & setti
519525
case Type::END:
520526
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown SYSTEM command");
521527
}
528+
529+
if (queries_with_on_cluster_at_end.contains(type) && !cluster.empty())
530+
formatOnCluster(ostr, settings);
522531
}
523532

524533

0 commit comments

Comments
 (0)