From 879273894422d240b0753e1c4f7c06a4cc976d2c Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Tue, 8 Oct 2019 10:01:17 +0300 Subject: [PATCH] Prohibit implicit conversion of UInt64-Field to DateTime64 --- dbms/src/Interpreters/convertFieldToType.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbms/src/Interpreters/convertFieldToType.cpp b/dbms/src/Interpreters/convertFieldToType.cpp index 1fed7bb712f..52320339a8a 100644 --- a/dbms/src/Interpreters/convertFieldToType.cpp +++ b/dbms/src/Interpreters/convertFieldToType.cpp @@ -208,11 +208,12 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID return dynamic_cast(type).castToValue(src); } - if (which_type.isDateOrDateTime() && src.getType() == Field::Types::UInt64) + if (which_type.isDateOrDateTime() && !which_type.isDateTime64() && src.getType() == Field::Types::UInt64) { /// We don't need any conversion UInt64 is under type of Date and DateTime return src; } + // TODO (vnemkov): extra cases for DateTime64: converting from integer, converting from Decimal if (src.getType() == Field::Types::String) {