Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
joechenrh committed Jan 14, 2025
1 parent e46da71 commit c6e6958
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sync_diff_inspector/utils/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func GetTableInfoBySQL(createTableSQL string, parser2 *parser.Parser) (table *mo

s, ok := stmt.(*ast.CreateTableStmt)
if ok {
table, err := ddl.BuildTableInfoWithStmt(metabuild.NewContext(), s, mysql.DefaultCharset, "", nil)
table, err := ddl.BuildTableInfoWithStmt(metabuild.NewNonStrictContext(), s, mysql.DefaultCharset, "", nil)
if err != nil {
return nil, errors.Trace(err)
}
Expand Down
6 changes: 6 additions & 0 deletions sync_diff_inspector/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,3 +682,9 @@ func TestCompareBlob(t *testing.T) {
}
}
}

func TestSQLWithInvalidOptions(t *testing.T) {
tblInfo, err := GetTableInfoBySQL("CREATE TABLE `t4` (`create_by` datetime NOT NULL DEFAULT '0000-00-00 00:00:00')", parser.New())
require.NoError(t, err)
require.Equal(t, tblInfo.Columns[0].DefaultValue.(string), "0000-00-00 00:00:00")
}

0 comments on commit c6e6958

Please sign in to comment.