Skip to content

Commit

Permalink
update sqlmode in UT
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Jun 6, 2019
1 parent a11badb commit 66b0c2d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4072,7 +4072,14 @@ func (s *testIntegrationSuite) TestDecimalConvertToTime(c *C) {

func (s *testIntegrationSuite) TestIssue9732(c *C) {
tk := testkit.NewTestKit(c, s.store)
defer s.cleanEnv(c)
r := tk.MustQuery("select @@sql_mode")
m := fmt.Sprintf("%v", r.Rows()[0])
m = strings.Trim(m, "[]")
tk.MustExec(fmt.Sprintf("set sql_mode='%v'", m+",NO_ZERO_DATE"))
defer func() {
tk.MustExec(fmt.Sprintf("set sql_mode='%v'", m))
s.cleanEnv(c)
}()

tk.MustQuery(`select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));`).Check(testkit.Rows("<nil> <nil> <nil> <nil>"))
Expand Down

0 comments on commit 66b0c2d

Please sign in to comment.