Skip to content

Commit 40aad3e

Browse files
committed
address comments
1 parent cc0babc commit 40aad3e

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

ddl/db_test.go

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,25 +2133,30 @@ func (s *testDBSuite) TestCheckColumnCantHaveDefaultValue(c *C) {
21332133
s.tk.MustExec("set sql_mode='';")
21342134
s.tk.MustExec("drop table if exists text_default_text;")
21352135
s.tk.MustExec("create table text_default_text(c1 text not null default '');")
2136-
ctx := s.tk.Se.(sessionctx.Context)
2137-
is := domain.GetDomain(ctx).InfoSchema()
2138-
tblInfo, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("text_default_text"))
2139-
c.Assert(err, IsNil)
2140-
c.Assert(tblInfo.Meta().Columns[0].DefaultValue, Equals, "")
2136+
s.tk.MustQuery(`show create table text_default_text`).Check(testutil.RowsWithSep("|",
2137+
""+
2138+
"text_default_text CREATE TABLE `text_default_text` (\n"+
2139+
" `c1` text NOT NULL\n"+
2140+
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin",
2141+
))
21412142

21422143
s.tk.MustExec("drop table if exists text_default_blob;")
21432144
s.tk.MustExec("create table text_default_blob(c1 blob not null default '');")
2144-
is = domain.GetDomain(ctx).InfoSchema()
2145-
tblInfo, err = is.TableByName(model.NewCIStr("test"), model.NewCIStr("text_default_blob"))
2146-
c.Assert(err, IsNil)
2147-
c.Assert(tblInfo.Meta().Columns[0].DefaultValue, Equals, "")
2145+
s.tk.MustQuery(`show create table text_default_blob`).Check(testutil.RowsWithSep("|",
2146+
""+
2147+
"text_default_blob CREATE TABLE `text_default_blob` (\n"+
2148+
" `c1` blob NOT NULL\n"+
2149+
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin",
2150+
))
21482151

21492152
s.tk.MustExec("drop table if exists text_default_json;")
21502153
s.tk.MustExec("create table text_default_json(c1 json not null default '');")
2151-
is = domain.GetDomain(ctx).InfoSchema()
2152-
tblInfo, err = is.TableByName(model.NewCIStr("test"), model.NewCIStr("text_default_json"))
2153-
c.Assert(err, IsNil)
2154-
c.Assert(tblInfo.Meta().Columns[0].DefaultValue, Equals, `null`)
2154+
s.tk.MustQuery(`show create table text_default_json`).Check(testutil.RowsWithSep("|",
2155+
""+
2156+
"text_default_json CREATE TABLE `text_default_json` (\n"+
2157+
" `c1` json NOT NULL DEFAULT 'null'\n"+
2158+
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin",
2159+
))
21552160
}
21562161

21572162
func (s *testDBSuite) TestCharacterSetInColumns(c *C) {

0 commit comments

Comments
 (0)