Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao committed Aug 29, 2018
1 parent a9f82e6 commit a0a844e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions executor/ddl.go
Expand Up @@ -154,15 +154,13 @@ func (e *DDLExec) executeCreateIndex(s *ast.CreateIndexStmt) error {
return errors.Trace(err)
}

var errForbidDrop = errors.New("Drop tidb system tables is forbidden")

func (e *DDLExec) executeDropDatabase(s *ast.DropDatabaseStmt) error {
dbName := model.NewCIStr(s.Name)

// Protect important system table from been dropped by a mistake.
// I can hardly find a case that a user really need to do this.
if dbName.L == "mysql" {
return errors.Trace(errForbidDrop)
return errors.New("Drop 'mysql' database is forbidden")
}

err := domain.GetDomain(e.ctx).DDL().DropSchema(e.ctx, dbName)
Expand Down Expand Up @@ -226,7 +224,7 @@ func (e *DDLExec) executeDropTable(s *ast.DropTableStmt) error {
// Protect important system table from been dropped by a mistake.
// I can hardly find a case that a user really need to do this.
if isSystemTable(tn.Schema.L, tn.Name.L) {
return errors.Trace(errForbidDrop)
return errors.Errorf("Drop tidb system table '%s.%s' is forbidden", tn.Schema.L, tn.Name.L)
}

if config.CheckTableBeforeDrop {
Expand Down

0 comments on commit a0a844e

Please sign in to comment.