diff --git a/executor/write_test.go b/executor/write_test.go index d39e9cfce8309..565c018e3c7f2 100644 --- a/executor/write_test.go +++ b/executor/write_test.go @@ -914,6 +914,8 @@ func (s *testSuite) TestUpdate(c *C) { tk.MustExec("CREATE TABLE `t` ( `c1` year DEFAULT NULL, `c2` year DEFAULT NULL, `c3` date DEFAULT NULL, `c4` datetime DEFAULT NULL, KEY `idx` (`c1`,`c2`))") _, err = tk.Exec("UPDATE t SET c2=16777215 WHERE c1>= -8388608 AND c1 < -9 ORDER BY c1 LIMIT 2") c.Assert(err.Error(), Equals, "cannot convert datum from bigint to type year.") + + tk.MustExec("update (select * from t) t set c1 = 1111111") } // TestUpdateCastOnlyModifiedValues for issue #4514. diff --git a/plan/rule_eliminate_projection.go b/plan/rule_eliminate_projection.go index 009d83374833d..26b7f7fa703ab 100644 --- a/plan/rule_eliminate_projection.go +++ b/plan/rule_eliminate_projection.go @@ -90,10 +90,8 @@ func eliminatePhysicalProjection(p PhysicalPlan) PhysicalPlan { newRoot := doPhysicalProjectionElimination(p) newCols := newRoot.Schema().Columns for i, oldCol := range oldSchema.Columns { - newCols[i].DBName = oldCol.DBName - newCols[i].TblName = oldCol.TblName - newCols[i].ColName = oldCol.ColName - newCols[i].OrigTblName = oldCol.OrigTblName + oldCol.Index = newCols[i].Index + newRoot.Schema().Columns[i] = oldCol } return newRoot }