Skip to content

Commit

Permalink
executor: fix overflow error message of update
Browse files Browse the repository at this point in the history
  • Loading branch information
exialin committed Nov 26, 2018
1 parent cd7e27d commit 8d690dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions executor/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ func (e *UpdateExec) handleErr(colName model.CIStr, rowIdx int, err error) error
return resetErrDataTooLong(colName.O, rowIdx+1, err)
}

if types.ErrOverflow.Equal(err) {
return types.ErrWarnDataOutOfRange.GenWithStackByArgs(colName.O, rowIdx+1)
}

return errors.Trace(err)
}

Expand Down
7 changes: 7 additions & 0 deletions executor/write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,13 @@ func (s *testSuite) TestUpdate(c *C) {
tk.MustExec(`CREATE TABLE t1 (c1 float)`)
tk.MustExec("INSERT INTO t1 SET c1 = 1")
tk.MustExec("UPDATE t1 SET c1 = 1.2 WHERE c1=1;")

// issue 8119
tk.MustExec("drop table if exists t;")
tk.MustExec("create table t (c1 float(1,1));")
tk.MustExec("insert into t values (0.0);")
_, err = tk.Exec("update t set c1 = 2.0;")
c.Assert(types.ErrWarnDataOutOfRange.Equal(err), IsTrue)
}

func (s *testSuite) TestPartitionedTableUpdate(c *C) {
Expand Down

0 comments on commit 8d690dc

Please sign in to comment.