Skip to content

Commit

Permalink
expression: make regex binary and rlike binary be case sensitive (#…
Browse files Browse the repository at this point in the history
…11505)

All tests passed, auto merged by Bot
  • Loading branch information
sre-bot authored Jul 30, 2019
1 parent 572bc10 commit cb05ebb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion expression/builtin_like.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (c *regexpFunctionClass) getFunction(ctx sessionctx.Context, args []Express
bf := newBaseBuiltinFuncWithTp(ctx, args, types.ETInt, types.ETString, types.ETString)
bf.tp.Flen = 1
var sig builtinFunc
if types.IsBinaryStr(args[0].GetType()) {
if types.IsBinaryStr(args[0].GetType()) || types.IsBinaryStr(args[1].GetType()) {
sig = &builtinRegexpBinarySig{bf}
} else {
sig = &builtinRegexpSig{bf}
Expand Down
6 changes: 6 additions & 0 deletions expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2373,18 +2373,24 @@ func (s *testIntegrationSuite) TestBuiltin(c *C) {
result.Check(testkit.Rows("1"))
result = tk.MustQuery(`select b regexp 'Xt' from t;`)
result.Check(testkit.Rows("1"))
result = tk.MustQuery(`select b regexp binary 'Xt' from t;`)
result.Check(testkit.Rows("0"))
result = tk.MustQuery(`select c regexp 'Xt' from t;`)
result.Check(testkit.Rows("0"))
result = tk.MustQuery(`select d regexp 'Xt' from t;`)
result.Check(testkit.Rows("0"))
result = tk.MustQuery(`select a rlike 'Xt' from t;`)
result.Check(testkit.Rows("1"))
result = tk.MustQuery(`select a rlike binary 'Xt' from t;`)
result.Check(testkit.Rows("0"))
result = tk.MustQuery(`select b rlike 'Xt' from t;`)
result.Check(testkit.Rows("1"))
result = tk.MustQuery(`select c rlike 'Xt' from t;`)
result.Check(testkit.Rows("0"))
result = tk.MustQuery(`select d rlike 'Xt' from t;`)
result.Check(testkit.Rows("0"))
result = tk.MustQuery(`select 'a' regexp 'A', 'a' regexp binary 'A'`)
result.Check(testkit.Rows("1 0"))

// testCase is for like and regexp
type testCase struct {
Expand Down

0 comments on commit cb05ebb

Please sign in to comment.