Closed
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Amended case:
insert into t value( CAST(BINARY(X'c2c2c2c2') AS CHAR(2)));
ERROR 1406 (22001): Data too long for column 'a' at row 1
create table t(a varchar(2)/char(2))
load data local file 'xxxx' into table t // file contains Binary(X'c2c2c2c2')
When we load data to a column of CHAR(2) of a existed table with data BINARY(X'c2c2c2c2'). It will succeed in
insertion ignoring the data-too-long error. (make it as warning)
Reason: Cast function will throw data-too-long error and return the truncated string equal to X'c2c2'
, actually the
returned truncated value is still invalid cause it contains the non-utf8 character.
2. What did you expect to see? (Required)
Load data should return a error.
3. What did you see instead (Required)
Load data successfully
4. What is your TiDB version? (Required)
master