From cd34cacee25b3194ba446d7530fdfc19d499a018 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 24 Jun 2020 16:14:04 +0300 Subject: [PATCH] Keep alias after substitution of query parameters #11914 --- src/Interpreters/ReplaceQueryParameterVisitor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Interpreters/ReplaceQueryParameterVisitor.cpp b/src/Interpreters/ReplaceQueryParameterVisitor.cpp index 5c29c722f88..7a5cec35807 100644 --- a/src/Interpreters/ReplaceQueryParameterVisitor.cpp +++ b/src/Interpreters/ReplaceQueryParameterVisitor.cpp @@ -49,6 +49,7 @@ void ReplaceQueryParameterVisitor::visitQueryParameter(ASTPtr & ast) const auto & ast_param = ast->as(); const String & value = getParamValue(ast_param.name); const String & type_name = ast_param.type; + String alias = ast_param.alias; const auto data_type = DataTypeFactory::instance().get(type_name); auto temp_column_ptr = data_type->createColumn(); @@ -63,6 +64,7 @@ void ReplaceQueryParameterVisitor::visitQueryParameter(ASTPtr & ast) + value.substr(0, read_buffer.count()), ErrorCodes::BAD_QUERY_PARAMETER); ast = addTypeConversionToAST(std::make_shared(temp_column[0]), type_name); + ast->setAlias(alias); } }