mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-16 12:44:42 +00:00
Update ActionsVisitor.cpp
This commit is contained in:
parent
b642bd494d
commit
0f92f60ab2
@ -510,14 +510,15 @@ void ActionsMatcher::visit(const ASTIdentifier & identifier, const ASTPtr & ast,
|
|||||||
/// The requested column is not in the block.
|
/// The requested column is not in the block.
|
||||||
/// If such a column exists in the table, then the user probably forgot to surround it with an aggregate function or add it to GROUP BY.
|
/// If such a column exists in the table, then the user probably forgot to surround it with an aggregate function or add it to GROUP BY.
|
||||||
|
|
||||||
for (const auto & column_name_type : data.source_columns) {
|
for (const auto & column_name_type : data.source_columns)
|
||||||
if (column_name_type.name == column_name.get(ast)) {
|
{
|
||||||
|
if (column_name_type.name == column_name.get(ast))
|
||||||
|
{
|
||||||
throw Exception("Column " + backQuote(column_name.get(ast)) + " is not under aggregate function and not in GROUP BY",
|
throw Exception("Column " + backQuote(column_name.get(ast)) + " is not under aggregate function and not in GROUP BY",
|
||||||
ErrorCodes::NOT_AN_AGGREGATE);
|
ErrorCodes::NOT_AN_AGGREGATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Special check for WITH statement alias. Add alias action to be able to use this alias.
|
/// Special check for WITH statement alias. Add alias action to be able to use this alias.
|
||||||
if (identifier.prefer_alias_to_column_name && !identifier.alias.empty())
|
if (identifier.prefer_alias_to_column_name && !identifier.alias.empty())
|
||||||
data.addAction(ExpressionAction::addAliases({{identifier.name, identifier.alias}}));
|
data.addAction(ExpressionAction::addAliases({{identifier.name, identifier.alias}}));
|
||||||
|
Loading…
Reference in New Issue
Block a user