Skip to content

Commit a465300

Browse files
authored
ddl: update TestDefaultColumnWithReplace error code (pingcap#51115)
close pingcap#51114
1 parent aca145b commit a465300

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/ddl/db_integration_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,16 @@ func TestDefaultColumnWithReplace(t *testing.T) {
16281628

16291629
// insert records
16301630
tk.MustExec("insert into t(c) values (1),(2),(3)")
1631+
// Different UUID values will result in different error code.
16311632
tk.MustGetErrCode("insert into t1(c) values (1)", errno.ErrTruncatedWrongValue)
1633+
_, err := tk.Exec("insert into t1(c) values (1)")
1634+
originErr := errors.Cause(err)
1635+
tErr, ok := originErr.(*terror.Error)
1636+
require.Truef(t, ok, "expect type 'terror.Error', but obtain '%T': %v", originErr, originErr)
1637+
sqlErr := terror.ToSQLError(tErr)
1638+
if int(sqlErr.Code) != errno.ErrTruncatedWrongValue {
1639+
require.Equal(t, errno.ErrDataOutOfRange, int(sqlErr.Code))
1640+
}
16321641

16331642
rows := tk.MustQuery("SELECT c1 from t").Rows()
16341643
for _, row := range rows {

0 commit comments

Comments
 (0)