diff --git a/dbms/src/Interpreters/JoinToSubqueryTransformVisitor.cpp b/dbms/src/Interpreters/JoinToSubqueryTransformVisitor.cpp index f9a7bdb6401..16c04f0673a 100644 --- a/dbms/src/Interpreters/JoinToSubqueryTransformVisitor.cpp +++ b/dbms/src/Interpreters/JoinToSubqueryTransformVisitor.cpp @@ -66,6 +66,8 @@ struct ColumnAliasesMatcher if (is_public) identifier->setAlias(long_name); } + else if (is_public) + identifier->setAlias(identifier->name); /// prevent crop long to short name } else { diff --git a/dbms/tests/queries/0_stateless/00820_multiple_joins.reference b/dbms/tests/queries/0_stateless/00820_multiple_joins.reference index 71686851e86..2e7d8660562 100644 --- a/dbms/tests/queries/0_stateless/00820_multiple_joins.reference +++ b/dbms/tests/queries/0_stateless/00820_multiple_joins.reference @@ -5,9 +5,9 @@ 0 0 0 10 100 1000 20 200 2000 -┌─t1.a─┬─t2.a─┬─t2.b─┬─t3.b─┬─t3.c─┬─a─┬─b─┬─c─┐ -│ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ -└──────┴──────┴──────┴──────┴──────┴───┴───┴───┘ +┌─t1.a─┬─t2.a─┬─t2.b─┬─t3.b─┬─t3.c─┬─t5.a─┬─t5.b─┬─t5.c─┐ +│ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ +└──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘ 0 0 0 0 6 6 60 60 12 12 120 120