Keep alias after substitution of query parameters #11914

This commit is contained in:
Alexey Milovidov 2020-06-24 16:14:04 +03:00
parent 2da7b356ab
commit cd34cacee2

View File

@ -49,6 +49,7 @@ void ReplaceQueryParameterVisitor::visitQueryParameter(ASTPtr & ast)
const auto & ast_param = ast->as<ASTQueryParameter &>();
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<ASTLiteral>(temp_column[0]), type_name);
ast->setAlias(alias);
}
}