mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
dbms: improved type checking in IN [#METR-16793].
This commit is contained in:
parent
84c2351774
commit
bff45a25fa
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user