Skip to content

Commit eb69948

Browse files
committed
refine set default sql mode in test
Signed-off-by: elijah <[email protected]>
1 parent 633ef79 commit eb69948

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ddl/db_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,9 +1483,6 @@ func TestBuildMaxLengthIndexWithNonRestrictedSqlMode(t *testing.T) {
14831483
tk := testkit.NewTestKit(t, store)
14841484
tk.MustExec("use test")
14851485

1486-
r := tk.MustQuery("select @@sql_mode")
1487-
defaultSQLMode := r.Rows()[0][0].(string)
1488-
14891486
maxIndexLength := config.GetGlobalConfig().MaxIndexLength
14901487

14911488
tt := []struct {
@@ -1522,7 +1519,7 @@ func TestBuildMaxLengthIndexWithNonRestrictedSqlMode(t *testing.T) {
15221519
for _, cs := range charset.CharacterSetInfos {
15231520
tableName := fmt.Sprintf("t_%s", cs.Name)
15241521
tk.MustExec(fmt.Sprintf("drop table if exists %s", tableName))
1525-
tk.MustExec(fmt.Sprintf("set @@sql_mode='%s'", defaultSQLMode))
1522+
tk.MustExec("set @@sql_mode=default")
15261523

15271524
// test in strict sql mode
15281525
maxLen := cs.Maxlen
@@ -1587,7 +1584,7 @@ func TestBuildMaxLengthIndexWithNonRestrictedSqlMode(t *testing.T) {
15871584
tk.MustGetErrCode(sql, errno.ErrTooLongKey)
15881585

15891586
// The multiple column index in which the length sum exceeds the maximum size
1590-
// will return an error instead produce a warning.
1587+
// will return an error instead produce a warning in strict sql mode.
15911588
indexLen = fmt.Sprintf("(%d)", expectKeyLength)
15921589
sql = fmt.Sprintf(sqlTemplate, mkTable, col, "", indexLen, ", age", cs.Name)
15931590
tk.MustGetErrCode(sql, errno.ErrTooLongKey)

0 commit comments

Comments
 (0)