diff --git a/ddl/db_integration_test.go b/ddl/db_integration_test.go index b9bba64562a4b..7cbd8aca4c6d8 100644 --- a/ddl/db_integration_test.go +++ b/ddl/db_integration_test.go @@ -2893,8 +2893,21 @@ func (s *testIntegrationSuite3) TestCreateTemporaryTable(c *C) { // Not support yet. tk.MustGetErrCode("create global temporary table t (id int) on commit preserve rows", errno.ErrUnsupportedDDLOperation) - // Engine type can only be 'memory' or empty for now. - tk.MustGetErrCode("create global temporary table t (id int) engine = 'innodb' on commit delete rows", errno.ErrUnsupportedDDLOperation) + + // Engine type can be anyone, see https://github.com/pingcap/tidb/issues/28541. + tk.MustExec("drop table if exists tengine") + tk.MustExec("create global temporary table tengine (id int) engine = 'innodb' on commit delete rows") + tk.MustExec("drop table if exists tengine") + tk.MustExec("create global temporary table tengine (id int) engine = 'memory' on commit delete rows") + tk.MustExec("drop table if exists tengine") + tk.MustExec("create global temporary table tengine (id int) engine = 'myisam' on commit delete rows") + tk.MustExec("drop table if exists tengine") + tk.MustExec("create temporary table tengine (id int) engine = 'innodb'") + tk.MustExec("drop table if exists tengine") + tk.MustExec("create temporary table tengine (id int) engine = 'memory'") + tk.MustExec("drop table if exists tengine") + tk.MustExec("create temporary table tengine (id int) engine = 'myisam'") + tk.MustExec("drop table if exists tengine") // Create local temporary table. tk.MustExec("create database tmp_db") @@ -2936,9 +2949,6 @@ func (s *testIntegrationSuite3) TestCreateTemporaryTable(c *C) { c.Assert(infoschema.ErrTableExists.Equal(err), IsTrue) tk.MustExec("create temporary table if not exists b_local_temp_table (id int)") - // Engine type can only be 'memory' or empty for now. - tk.MustGetErrCode("create temporary table te (id int) engine = 'innodb'", errno.ErrUnsupportedDDLOperation) - // Stale read see the local temporary table but can't read on it. tk.MustExec("START TRANSACTION READ ONLY AS OF TIMESTAMP NOW(3)") tk.MustGetErrMsg("select * from overlap", "can not stale read temporary table") diff --git a/ddl/ddl_api.go b/ddl/ddl_api.go index d0fd1b52c2e1a..3c68782cd36f3 100644 --- a/ddl/ddl_api.go +++ b/ddl/ddl_api.go @@ -2447,12 +2447,6 @@ func handleTableOptions(options []*ast.TableOption, tbInfo *model.TableInfo) err tbInfo.PreSplitRegions = op.UintValue case ast.TableOptionCharset, ast.TableOptionCollate: // We don't handle charset and collate here since they're handled in `getCharsetAndCollateInTableOption`. - case ast.TableOptionEngine: - if tbInfo.TempTableType != model.TempTableNone { - if op.StrValue != "" && !strings.EqualFold(op.StrValue, "memory") { - return errors.Trace(errUnsupportedEngineTemporary) - } - } case ast.TableOptionPlacementPolicy: tbInfo.PlacementPolicyRef = &model.PolicyRefInfo{ Name: model.NewCIStr(op.StrValue), diff --git a/ddl/error.go b/ddl/error.go index ee472545c508e..bd3b118a235d5 100644 --- a/ddl/error.go +++ b/ddl/error.go @@ -290,7 +290,6 @@ var ( ErrOptOnTemporaryTable = dbterror.ClassDDL.NewStd(mysql.ErrOptOnTemporaryTable) errUnsupportedOnCommitPreserve = dbterror.ClassDDL.NewStdErr(mysql.ErrUnsupportedDDLOperation, parser_mysql.Message("TiDB doesn't support ON COMMIT PRESERVE ROWS for now", nil)) - errUnsupportedEngineTemporary = dbterror.ClassDDL.NewStdErr(mysql.ErrUnsupportedDDLOperation, parser_mysql.Message("TiDB doesn't support this kind of engine for temporary table", nil)) errUnsupportedClusteredSecondaryKey = dbterror.ClassDDL.NewStdErr(mysql.ErrUnsupportedDDLOperation, parser_mysql.Message("CLUSTERED/NONCLUSTERED keyword is only supported for primary key", nil)) // ErrUnsupportedLocalTempTableDDL returns when ddl operation unsupported for local temporary table