Skip to content

Commit

Permalink
table: log more detail on incorrect utf8 value. (pingcap#2916)
Browse files Browse the repository at this point in the history
  • Loading branch information
coocood authored Mar 23, 2017
1 parent 7aa024c commit e402430
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions table/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ func CastValue(ctx context.Context, val types.Datum, col *model.ColumnInfo) (cas
str := casted.GetString()
for i, r := range str {
if r == utf8.RuneError {
log.Errorf("[%d] incorrect utf8 value: %x for column %s",
ctx.GetSessionVars().ConnectionID, []byte(str), col.Name)
// Truncate to valid utf8 string.
casted = types.NewStringDatum(str[:i])
err = sc.HandleTruncate(ErrTruncateWrongValue)
Expand Down

0 comments on commit e402430

Please sign in to comment.