diff --git a/src/ClickHouse/Source.cpp b/src/ClickHouse/Source.cpp index 9c80b22fb6..22fd71feb5 100644 --- a/src/ClickHouse/Source.cpp +++ b/src/ClickHouse/Source.cpp @@ -17,7 +17,7 @@ String constructSelectQuery(const String & database, const String & table, const auto query = "SELECT " + backQuoteIfNeed(col_names[0]); for (const auto & name : std::vector(std::next(col_names.begin()), col_names.end())) query.append(", " + backQuoteIfNeed(name)); - query.append(" FROM " + (database.empty() ? "" : backQuoteIfNeed(database) + ".") + table); + query.append(" FROM " + (database.empty() ? "" : backQuoteIfNeed(database) + ".") + backQuoteIfNeed(table)); return query; }