Skip to content

Commit

Permalink
load: fix load data with non-utf8 will succeed (#26054) (#26142)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Jul 15, 2021
1 parent 9e9f95c commit fb96fe7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,10 @@ func ResetContextOfStmt(ctx sessionctx.Context, s ast.StmtNode) (err error) {
case *ast.LoadDataStmt:
sc.DupKeyAsWarning = true
sc.BadNullAsWarning = true
sc.TruncateAsWarning = !vars.StrictSQLMode
// With IGNORE or LOCAL, data-interpretation errors become warnings and the load operation continues,
// even if the SQL mode is restrictive. For details: https://dev.mysql.com/doc/refman/8.0/en/load-data.html
// TODO: since TiDB only support the LOCAL by now, so the TruncateAsWarning are always true here.
sc.TruncateAsWarning = true
sc.InLoadDataStmt = true
case *ast.SelectStmt:
sc.InSelectStmt = true
Expand Down

0 comments on commit fb96fe7

Please sign in to comment.