diff --git a/types/time.go b/types/time.go index 6547eebd65191..f905ba8cfb24d 100644 --- a/types/time.go +++ b/types/time.go @@ -561,11 +561,17 @@ func (t *Time) check(sc *stmtctx.StatementContext) error { var err error switch t.Type { case mysql.TypeTimestamp: +<<<<<<< HEAD err = checkTimestampType(sc, t.Time) case mysql.TypeDatetime: err = checkDatetimeType(t.Time, allowZeroInDate, allowInvalidDate) case mysql.TypeDate: err = checkDateType(t.Time, allowZeroInDate, allowInvalidDate) +======= + err = checkTimestampType(sc, t.time) + case mysql.TypeDatetime, mysql.TypeDate: + err = checkDatetimeType(t.time, allowZeroInDate, allowInvalidDate) +>>>>>>> 667f2d7... types: fix parse date inconsistent with MySQL (#14405) } return errors.Trace(err) } diff --git a/types/time_test.go b/types/time_test.go index 5a00a4dca0f7f..01ba8f7710883 100644 --- a/types/time_test.go +++ b/types/time_test.go @@ -110,6 +110,8 @@ func (s *testTimeSuite) TestDateTime(c *C) { errTable := []string{ "1000-01-01 00:00:70", "1000-13-00 00:00:00", + "1201012736.0000", + "1201012736", "10000-01-01 00:00:00", "1000-09-31 00:00:00", "1001-02-29 00:00:00", @@ -177,6 +179,8 @@ func (s *testTimeSuite) TestDate(c *C) { errTable := []string{ "0121231", + "1201012736.0000", + "1201012736", "2019.01", }