Skip to content

Commit

Permalink
do nothing in err branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ou-bing committed Nov 5, 2020
1 parent 7271b1e commit 740385e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions executor/insert_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ import (
"github.com/pingcap/tidb/util/chunk"
"github.com/pingcap/tidb/util/dbterror"
"github.com/pingcap/tidb/util/execdetails"
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/memory"
"go.uber.org/zap"
)

// InsertValues is the data to insert.
Expand Down Expand Up @@ -294,7 +292,10 @@ func (e *InsertValues) handleErr(col *table.Column, val *types.Datum, rowIdx int
} else if types.ErrTruncated.Equal(err) {
err = types.ErrTruncated.GenWithStackByArgs(colName, rowIdx+1)
} else if types.ErrTruncatedWrongVal.Equal(err) && (colTp == mysql.TypeDuration || colTp == mysql.TypeDatetime) {
valStr, _ := val.ToString()
valStr, err1 := val.ToString()
if err1 != nil {
// do nothing
}
err = dbterror.ClassTable.NewStdErr(
errno.ErrTruncatedWrongValue,
mysql.Message("Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %d", nil),
Expand All @@ -304,7 +305,7 @@ func (e *InsertValues) handleErr(col *table.Column, val *types.Datum, rowIdx int
} else if types.ErrTruncatedWrongVal.Equal(err) || types.ErrWrongValue.Equal(err) {
valStr, err1 := val.ToString()
if err1 != nil {
logutil.BgLogger().Warn("truncate value failed", zap.Error(err1))
// do nothing
}
err = table.ErrTruncatedWrongValueForField.GenWithStackByArgs(types.TypeStr(colTp), valStr, colName, rowIdx+1)
}
Expand Down

0 comments on commit 740385e

Please sign in to comment.