Skip to content

Commit

Permalink
modify err
Browse files Browse the repository at this point in the history
Signed-off-by: lihaowei <haoweili35@gmail.com>
  • Loading branch information
Howie59 committed May 28, 2021
1 parent 4070e01 commit 6ffd9e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions executor/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ func (s *testSuite5) TestAdminCheckIndexInTemporaryMode(c *C) {
tk.MustExec("drop table if exists temporary_admin_test;")
tk.MustExec("create global temporary table temporary_admin_test (c1 int, c2 int, c3 int default 1, primary key (c1), index (c1), unique key(c2)) ON COMMIT DELETE ROWS;")
tk.MustExec("insert temporary_admin_test (c1, c2) values (1, 1), (2, 2), (3, 3);")
tk.MustGetErrCode("admin check table temporary_admin_test;", mysql.ErrAdminCheckTable)
_, err := tk.Exec("admin check table temporary_admin_test;")
c.Assert(err.Error(), Equals, core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin check table").Error())
tk.MustExec("drop table if exists temporary_admin_test;")

tk.MustExec("drop table if exists non_temporary_admin_test;")
Expand All @@ -96,14 +97,11 @@ func (s *testSuite5) TestAdminCheckIndexInTemporaryMode(c *C) {
tk.MustExec("drop table if exists temporary_admin_checksum_table_without_index_test;")
tk.MustExec("create global temporary table temporary_admin_checksum_table_with_index_test (id int, count int, PRIMARY KEY(id), KEY(count)) ON COMMIT DELETE ROWS;")
tk.MustExec("create global temporary table temporary_admin_checksum_table_without_index_test (id int, count int, PRIMARY KEY(id)) ON COMMIT DELETE ROWS;")
_, err := tk.Exec("admin checksum table temporary_admin_checksum_table_with_index_test;")
fmt.Println(core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin checksum table"))
fmt.Println(err.Error())
_, err = tk.Exec("admin checksum table temporary_admin_checksum_table_with_index_test;")
c.Assert(err.Error(), Equals, core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin checksum table").Error())
_, err = tk.Exec("admin checksum table temporary_admin_checksum_table_without_index_test;")
c.Assert(err.Error(), Equals, core.ErrOptOnTemporaryTable.GenWithStackByArgs("admin checksum table").Error())
tk.MustExec("drop table if exists temporary_admin_checksum_table_with_index_test;")
tk.MustExec("drop table if exists temporary_admin_checksum_table_without_index_test;")
tk.MustExec("drop table if exists temporary_admin_checksum_table_with_index_test,temporary_admin_checksum_table_without_index_test;")
}

func (s *testSuite5) TestAdminRecoverIndex(c *C) {
Expand Down
2 changes: 1 addition & 1 deletion planner/core/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ func (p *preprocessor) checkAdminCheckTableGrammar(stmt *ast.AdminStmt) {
if stmt.Tp == ast.AdminChecksumTable {
p.err = ErrOptOnTemporaryTable.GenWithStackByArgs("admin checksum table")
} else {
p.err = infoschema.ErrAdminCheckTable
p.err = ErrOptOnTemporaryTable.GenWithStackByArgs("admin check table")
}
return
}
Expand Down

0 comments on commit 6ffd9e2

Please sign in to comment.