diff --git a/src/Functions/globalVariable.cpp b/src/Functions/globalVariable.cpp index fc6796f1fbd..2ce81d09f5f 100644 --- a/src/Functions/globalVariable.cpp +++ b/src/Functions/globalVariable.cpp @@ -77,7 +77,8 @@ private: DataTypePtr type; Field value; }; - std::unordered_map global_variable_map = {{"max_allowed_packet", {std::make_shared(), 67108864}}}; + std::unordered_map global_variable_map = { + {"max_allowed_packet", {std::make_shared(), 67108864}}, {"version", {std::make_shared(), "5.7.30"}}}; }; diff --git a/src/Parsers/ExpressionElementParsers.cpp b/src/Parsers/ExpressionElementParsers.cpp index e9e0e4973a8..839d6598eb0 100644 --- a/src/Parsers/ExpressionElementParsers.cpp +++ b/src/Parsers/ExpressionElementParsers.cpp @@ -1295,7 +1295,7 @@ bool ParserMySQLGlobalVariable::parseImpl(Pos & pos, ASTPtr & node, Expected & e function_node->children.push_back(expr_list_args); node = function_node; - node->setAlias(name); + node->setAlias("@@" + name); return true; } diff --git a/tests/queries/0_stateless/01337_mysql_global_variables.reference b/tests/queries/0_stateless/01337_mysql_global_variables.reference index daa2cfb74b5..488ea5f1387 100644 --- a/tests/queries/0_stateless/01337_mysql_global_variables.reference +++ b/tests/queries/0_stateless/01337_mysql_global_variables.reference @@ -1,13 +1,15 @@ 0 -"max_allowed_packet" +"@@max_allowed_packet" 67108864 -"MAX_ALLOWED_PACKET" +"@@MAX_ALLOWED_PACKET" 67108864 -"max_allowed_packet","number" +"@@max_allowed_packet","number" 67108864,0 67108864,1 67108864,2 -"auto_increment_increment" +"@@auto_increment_increment" 0 "auto_increment_increment" 0 +"@@Version" +"5.7.30" diff --git a/tests/queries/0_stateless/01337_mysql_global_variables.sql b/tests/queries/0_stateless/01337_mysql_global_variables.sql index c529386ddde..b5b982d2852 100644 --- a/tests/queries/0_stateless/01337_mysql_global_variables.sql +++ b/tests/queries/0_stateless/01337_mysql_global_variables.sql @@ -4,3 +4,4 @@ SELECT @@MAX_ALLOWED_PACKET FORMAT CSVWithNames; SELECT @@max_allowed_packet, number FROM system.numbers LIMIT 3 FORMAT CSVWithNames; SELECT @@session.auto_increment_increment FORMAT CSVWithNames; SELECT @@session.auto_increment_increment AS auto_increment_increment FORMAT CSVWithNames; +SELECT @@Version FORMAT CSVWithNames;