diff --git a/executor/admin_test.go b/executor/admin_test.go index da555ef999578..39c4794f8e19c 100644 --- a/executor/admin_test.go +++ b/executor/admin_test.go @@ -86,6 +86,8 @@ func (s *testSuite5) TestAdminCheckIndexInTemporaryMode(c *C) { tk.MustExec("insert temporary_admin_test (c1, c2) values (1, 1), (2, 2), (3, 3);") _, err := tk.Exec("admin check table temporary_admin_test;") c.Assert(err.Error(), Equals, core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin check table").Error()) + _, err = tk.Exec("admin check index temporary_admin_test c1;") + c.Assert(err.Error(), Equals, core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin check index").Error()) tk.MustExec("drop table if exists temporary_admin_test;") tk.MustExec("drop table if exists non_temporary_admin_test;") diff --git a/planner/core/preprocess.go b/planner/core/preprocess.go index 3f7445eff9e29..fff5467ead5cd 100644 --- a/planner/core/preprocess.go +++ b/planner/core/preprocess.go @@ -680,11 +680,13 @@ func (p *preprocessor) checkAdminCheckTableGrammar(stmt *ast.AdminStmt) { return } tempTableType := tableInfo.Meta().TempTableType - if (stmt.Tp == ast.AdminCheckTable || stmt.Tp == ast.AdminChecksumTable) && tempTableType != model.TempTableNone { + if (stmt.Tp == ast.AdminCheckTable || stmt.Tp == ast.AdminChecksumTable || stmt.Tp == ast.AdminCheckIndex) && tempTableType != model.TempTableNone { if stmt.Tp == ast.AdminChecksumTable { p.err = ErrOptOnTemporaryTable.GenWithStackByArgs("admin checksum table") - } else { + } else if stmt.Tp == ast.AdminCheckTable { p.err = ErrOptOnTemporaryTable.GenWithStackByArgs("admin check table") + } else { + p.err = ErrOptOnTemporaryTable.GenWithStackByArgs("admin check index") } return }