dbms: improved type checking in IN [#METR-16793].

This commit is contained in:
Alexey Milovidov 2015-06-12 02:09:56 +03:00
parent 84c2351774
commit bff45a25fa

View File

@ -325,8 +325,21 @@ static Field convertToType(const Field & src, const IDataType & type)
+ Field::Types::toString(src.getType()) + " literal at right");
}
}
else
{
if (src.getType() == Field::Types::UInt64
|| src.getType() == Field::Types::Int64
|| src.getType() == Field::Types::Float64
|| src.getType() == Field::Types::Null
|| (src.getType() == Field::Types::String
&& !typeid_cast<const DataTypeString *>(&type)
&& !typeid_cast<const DataTypeFixedString *>(&type))
|| (src.getType() == Field::Types::Array
&& !typeid_cast<const DataTypeArray *>(&type)))
throw Exception("Type mismatch in IN section: " + type.getName() + " at left, "
+ Field::Types::toString(src.getType()) + " literal at right");
}
/// В остальных случаях, приведение типа не осуществляется.
return src;
}