diff --git a/executor/ddl.go b/executor/ddl.go index 00135ddc69fa0..2f10555d21e1e 100644 --- a/executor/ddl.go +++ b/executor/ddl.go @@ -316,7 +316,7 @@ func (e *DDLExec) dropTableObject(objects []*ast.TableName, obt objectType, ifEx return err } tempTableType := tableInfo.Meta().TempTableType - if obt == tableObject && config.CheckTableBeforeDrop && tempTableType != model.TempTableGlobal && tempTableType != model.TempTableLocal { + if obt == tableObject && config.CheckTableBeforeDrop && tempTableType == model.TempTableNone { logutil.BgLogger().Warn("admin check table before drop", zap.String("database", fullti.Schema.O), zap.String("table", fullti.Name.O), diff --git a/expression/integration_test.go b/expression/integration_test.go index f15dc5822be15..a3d983069cce9 100644 --- a/expression/integration_test.go +++ b/expression/integration_test.go @@ -9161,8 +9161,10 @@ func (s *testIntegrationSuite) TestIssue24429(c *C) { tk.MustExec("set @@sql_mode = ANSI_QUOTES;") tk.MustExec("use test") + tk.MustExec("drop table if exists t;") tk.MustExec("create table t (a int);") tk.MustQuery(`select t."a"=10 from t;`).Check(testkit.Rows()) + tk.MustExec("drop table if exists t;") } func (s *testIntegrationSuite) TestVitessHash(c *C) { diff --git a/planner/core/preprocess.go b/planner/core/preprocess.go index f9e792831bfba..9683e6d65fbb8 100644 --- a/planner/core/preprocess.go +++ b/planner/core/preprocess.go @@ -574,7 +574,7 @@ func (p *preprocessor) checkAdminCheckTableGrammar(stmt *ast.AdminStmt) { return } tempTableType := tableInfo.Meta().TempTableType - if stmt.Tp == ast.AdminCheckTable && (tempTableType == model.TempTableGlobal || tempTableType == model.TempTableLocal) { + if stmt.Tp == ast.AdminCheckTable && tempTableType != model.TempTableNone { p.err = infoschema.ErrAdminCheckTable return }