@@ -1300,6 +1300,18 @@ func (s *testIntegrationSuite) TestTimeBuiltin(c *C) {
13001300 result .Check (testkit .Rows ("2017-01-18 12:39:50.123 2017-01-18 12:39:50.999" ))
13011301 result = tk .MustQuery ("select timestamp('2003-12-31', '01:01:01.01'), timestamp('2003-12-31 12:34', '01:01:01.01')," +
13021302 " timestamp('2008-12-31','00:00:00.0'), timestamp('2008-12-31 00:00:00.000');" )
1303+
1304+ tk .MustQuery (`select timestampadd(second, 1, cast("2001-01-01" as date))` ).Check (testkit .Rows ("2001-01-01 00:00:01" ))
1305+ tk .MustQuery (`select timestampadd(hour, 1, cast("2001-01-01" as date))` ).Check (testkit .Rows ("2001-01-01 01:00:00" ))
1306+ tk .MustQuery (`select timestampadd(day, 1, cast("2001-01-01" as date))` ).Check (testkit .Rows ("2001-01-02" ))
1307+ tk .MustQuery (`select timestampadd(month, 1, cast("2001-01-01" as date))` ).Check (testkit .Rows ("2001-02-01" ))
1308+ tk .MustQuery (`select timestampadd(year, 1, cast("2001-01-01" as date))` ).Check (testkit .Rows ("2002-01-01" ))
1309+ tk .MustQuery (`select timestampadd(second, 1, cast("2001-01-01" as datetime))` ).Check (testkit .Rows ("2001-01-01 00:00:01" ))
1310+ tk .MustQuery (`select timestampadd(hour, 1, cast("2001-01-01" as datetime))` ).Check (testkit .Rows ("2001-01-01 01:00:00" ))
1311+ tk .MustQuery (`select timestampadd(day, 1, cast("2001-01-01" as datetime))` ).Check (testkit .Rows ("2001-01-02 00:00:00" ))
1312+ tk .MustQuery (`select timestampadd(month, 1, cast("2001-01-01" as datetime))` ).Check (testkit .Rows ("2001-02-01 00:00:00" ))
1313+ tk .MustQuery (`select timestampadd(year, 1, cast("2001-01-01" as datetime))` ).Check (testkit .Rows ("2002-01-01 00:00:00" ))
1314+
13031315 result .Check (testkit .Rows ("2003-12-31 01:01:01.01 2003-12-31 13:35:01.01 2008-12-31 00:00:00.0 2008-12-31 00:00:00.000" ))
13041316 result = tk .MustQuery ("select timestamp('2003-12-31', 1), timestamp('2003-12-31', -1);" )
13051317 result .Check (testkit .Rows ("2003-12-31 00:00:01 2003-12-30 23:59:59" ))
0 commit comments