Skip to content

Commit

Permalink
[parser] charsert: make collation case insensitive (pingcap#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
winkyao authored and xhebox committed Oct 8, 2021
1 parent b26e62f commit 19e0be4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions parser/charset/charset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions parser/charset/charset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 19e0be4

Please sign in to comment.