diff --git a/parser/charset/charset.go b/parser/charset/charset.go index c42c13e4b09fc..0c0d3820efa56 100644 --- a/parser/charset/charset.go +++ b/parser/charset/charset.go @@ -94,6 +94,7 @@ func ValidCharsetAndCollation(cs string, co string) bool { if co == "" { return true } + co = strings.ToLower(co) _, ok = c.Collations[co] if !ok { return false diff --git a/parser/charset/charset_test.go b/parser/charset/charset_test.go index c400d97f183be..9492a562d6517 100644 --- a/parser/charset/charset_test.go +++ b/parser/charset/charset_test.go @@ -49,6 +49,12 @@ func (s *testCharsetSuite) TestValidCharset(c *C) { {"utf8", "utf8_invalid_ci", false}, {"utf16", "utf16_bin", false}, {"gb2312", "gb2312_chinese_ci", false}, + {"UTF8", "UTF8_BIN", true}, + {"UTF8", "utf8_bin", true}, + {"UTF8MB4", "utf8mb4_bin", true}, + {"UTF8MB4", "UTF8MB4_bin", true}, + {"UTF8MB4", "UTF8MB4_general_ci", true}, + {"Utf8", "uTf8_bIN", true}, } for _, tt := range tests { testValidCharset(c, tt.cs, tt.co, tt.succ)