Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dml: load data can succeed with with wrong utf8 character #25979

Closed
AilinKid opened this issue Jul 5, 2021 · 1 comment · Fixed by #26054
Closed

dml: load data can succeed with with wrong utf8 character #25979

AilinKid opened this issue Jul 5, 2021 · 1 comment · Fixed by #26054
Assignees
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@AilinKid
Copy link
Contributor

AilinKid commented Jul 5, 2021

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

@AilinKid AilinKid added the type/bug The issue is confirmed as a bug. label Jul 5, 2021
@AilinKid AilinKid self-assigned this Jul 5, 2021
@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants