Skip to content

Commit

Permalink
cherry pick pingcap#14405 to release-3.0
Browse files Browse the repository at this point in the history
Signed-off-by: sre-bot <sre-bot@pingcap.com>
  • Loading branch information
lonng authored and sre-bot committed Apr 9, 2020
1 parent d82cf4c commit 16257cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions types/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 4 additions & 0 deletions types/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -177,6 +179,8 @@ func (s *testTimeSuite) TestDate(c *C) {

errTable := []string{
"0121231",
"1201012736.0000",
"1201012736",
"2019.01",
}

Expand Down

0 comments on commit 16257cc

Please sign in to comment.