diff --git a/dbms/src/DataTypes/getLeastSupertype.cpp b/dbms/src/DataTypes/getLeastSupertype.cpp index e9ede465a42..a4f2f8b187a 100644 --- a/dbms/src/DataTypes/getLeastSupertype.cpp +++ b/dbms/src/DataTypes/getLeastSupertype.cpp @@ -243,12 +243,6 @@ DataTypePtr getLeastSupertype(const DataTypes & types) max_datetime64_precision = std::max(least_decimal_precision, max_datetime64_precision); const UInt32 scale = DataTypeDateTime64::maxPrecision() - max_datetime64_precision; - if (max_datetime64_precision == 0) - { - throw Exception(getExceptionMessagePrefix(types) + " because some of them have no lossless convertion to DateTime64", - ErrorCodes::NO_COMMON_TYPE); - } - return std::make_shared(scale); } } diff --git a/dbms/src/DataTypes/tests/gtest_data_type_get_common_type.cpp b/dbms/src/DataTypes/tests/gtest_data_type_get_common_type.cpp index b1ae7c5a8d5..93f7eeef16d 100644 --- a/dbms/src/DataTypes/tests/gtest_data_type_get_common_type.cpp +++ b/dbms/src/DataTypes/tests/gtest_data_type_get_common_type.cpp @@ -129,9 +129,10 @@ INSTANTIATE_TEST_CASE_P(data_type, {"Date DateTime", "DateTime"}, {"Date DateTime64(3)", "DateTime64(3)"}, {"DateTime DateTime64(3)", "DateTime64(3)"}, -// {"DateTime64(9) DateTime64(3)", "DateTime64(9)"}, -// {"DateTime DateTime64(12)", nullptr}, -// {"Date DateTime64(15)", nullptr}, + {"DateTime DateTime64(0)", "DateTime64(0)"}, + {"DateTime64(9) DateTime64(3)", "DateTime64(3)"}, + {"DateTime DateTime64(12)", "DateTime64(8)"}, + {"Date DateTime64(15)", "DateTime64(13)"}, {"String FixedString(32) FixedString(8)", "String"},