Skip to content

Commit

Permalink
executor: fix overflow error message of update (#8457)
Browse files Browse the repository at this point in the history
  • Loading branch information
exialin authored and zz-jason committed Nov 27, 2018
1 parent a3e25b2 commit 0d005a0
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
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
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 0d005a0

Please sign in to comment.