Skip to content

Commit

Permalink
add more test cases
Browse files Browse the repository at this point in the history
Signed-off-by: unconsolable <chenzhipeng2012@gmail.com>
  • Loading branch information
unconsolable committed Jan 7, 2022
1 parent fa25af0 commit 091ae73
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ddl/column_type_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2353,18 +2353,24 @@ func (s *testColumnTypeChangeSuite) TestChangeNullValueFromOtherTypeToTimestamp(
c.Assert(err.Error(), Equals, "[table:1048]Column 'a' cannot be null")
}

func (s *testColumnTypeChangeSuite) TestColumnTypeChangeFromFloatToDouble(c *C) {
func (s *testColumnTypeChangeSuite) TestColumnTypeChangeBetweenFloatAndDouble(c *C) {
// issue #31372
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")

prepare := func() {
prepare := func(createTableStmt string) {
tk.MustExec("drop table if exists t;")
tk.MustExec("create table t (a float(6,2));")
tk.MustExec(createTableStmt)
tk.MustExec("insert into t values (36.4), (24.1);")
}

prepare()
prepare("create table t (a float(6,2));")
tk.MustExec("alter table t modify a double(6,2)")
tk.MustQuery("select a from t;").Check(testkit.Rows("36.4", "24.1"))

prepare("create table t (a double(6,2));")
tk.MustExec("alter table t modify a double(6,1)")
tk.MustQuery("select a from t;").Check(testkit.Rows("36.4", "24.1"))
tk.MustExec("alter table t modify a float(6,1)")
tk.MustQuery("select a from t;").Check(testkit.Rows("36.4", "24.1"))
}

0 comments on commit 091ae73

Please sign in to comment.