diff --git a/br/pkg/gluetidb/glue.go b/br/pkg/gluetidb/glue.go index 06af5615ff451..abe239f7723dc 100644 --- a/br/pkg/gluetidb/glue.go +++ b/br/pkg/gluetidb/glue.go @@ -288,6 +288,8 @@ func (gs *tidbSession) CreateTable(ctx context.Context, dbName model.CIStr, tabl return errors.Trace(err) } gs.se.SetValue(sessionctx.QueryString, query) + // Disable foreign key check when batch create tables. + gs.se.GetSessionVars().ForeignKeyChecks = false // Clone() does not clone partitions yet :( table = table.Clone() if table.Partition != nil { diff --git a/executor/brie.go b/executor/brie.go index 608cfd6336b52..96896c0eb0119 100644 --- a/executor/brie.go +++ b/executor/brie.go @@ -524,6 +524,8 @@ func (gs *tidbGlueSession) CreateTable(ctx context.Context, dbName model.CIStr, return err } gs.se.SetValue(sessionctx.QueryString, result.String()) + // Disable foreign key check when batch create tables. + gs.se.GetSessionVars().ForeignKeyChecks = false // Clone() does not clone partitions yet :( table = table.Clone()