diff --git a/executor/executor_test.go b/executor/executor_test.go index dcbfec3fbd61b..454aa4fe32529 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -301,6 +301,15 @@ func (s *testSuite) TestAdmin(c *C) { tk.MustExec("alter table t1 add index idx_i(i);") tk.MustExec("alter table t1 add index idx_m(a,c,d,e,f,g,h,i,j);") tk.MustExec("admin check table t1;") + + tk.MustExec("drop table if exists t1;") + tk.MustExec("CREATE TABLE t1 (c1 int);") + tk.MustExec("INSERT INTO t1 SET c1 = 1;") + tk.MustExec("ALTER TABLE t1 ADD COLUMN cc1 CHAR(36) NULL DEFAULT '';") + tk.MustExec("ALTER TABLE t1 ADD COLUMN cc2 VARCHAR(36) NULL DEFAULT ''") + tk.MustExec("ALTER TABLE t1 ADD INDEX idx1 (cc1);") + tk.MustExec("ALTER TABLE t1 ADD INDEX idx2 (cc2);") + tk.MustExec("admin check table t1;") } func (s *testSuite) fillData(tk *testkit.TestKit, table string) { diff --git a/util/admin/admin.go b/util/admin/admin.go index 3e767f73021d3..98ae13811badd 100644 --- a/util/admin/admin.go +++ b/util/admin/admin.go @@ -391,12 +391,13 @@ func compareDatumSlice(sc *stmtctx.StatementContext, val1s, val2s []types.Datum) return false } for i, v := range val1s { - if v.Kind() == types.KindMysqlDecimal { + switch v.Kind() { + case types.KindMysqlDecimal, types.KindBytes: res, err := v.CompareDatum(sc, &val2s[i]) if err != nil || res != 0 { return false } - } else { + default: if !reflect.DeepEqual(v, val2s[i]) { return false }