@@ -43,14 +43,14 @@ import (
43
43
"github.com/pingcap/tidb/pkg/lightning/mydump"
44
44
"github.com/pingcap/tidb/pkg/lightning/verification"
45
45
"github.com/pingcap/tidb/pkg/lightning/worker"
46
+ "github.com/pingcap/tidb/pkg/meta/metabuild"
46
47
"github.com/pingcap/tidb/pkg/meta/model"
47
48
"github.com/pingcap/tidb/pkg/parser"
48
49
"github.com/pingcap/tidb/pkg/parser/ast"
49
50
_ "github.com/pingcap/tidb/pkg/planner/core" // to setup expression.EvalAstExpr. Otherwise we cannot parse the default value
50
51
"github.com/pingcap/tidb/pkg/table/tables"
51
52
"github.com/pingcap/tidb/pkg/types"
52
53
"github.com/pingcap/tidb/pkg/util/dbterror"
53
- "github.com/pingcap/tidb/pkg/util/mock"
54
54
pdhttp "github.com/tikv/pd/client/http"
55
55
"go.uber.org/zap"
56
56
)
@@ -428,15 +428,15 @@ func newTableInfo(createTblSQL string, tableID int64) (*model.TableInfo, error)
428
428
log .L ().Error (errMsg , zap .Error (err ), zap .String ("sql" , createTblSQL ))
429
429
return nil , errors .Trace (err )
430
430
}
431
- sctx := mock .NewContext ()
432
431
createTableStmt , ok := astNode .(* ast.CreateTableStmt )
433
432
if ! ok {
434
433
return nil , errors .New ("cannot transfer the parsed SQL as an CREATE TABLE statement" )
435
434
}
436
- info , err := ddl .MockTableInfo ( sctx , createTableStmt , tableID )
435
+ info , err := ddl .BuildTableInfoFromAST ( metabuild . NewNonStrictContext () , createTableStmt )
437
436
if err != nil {
438
437
return nil , errors .Trace (err )
439
438
}
439
+ info .ID = tableID
440
440
info .State = model .StatePublic
441
441
return info , nil
442
442
}
0 commit comments