// regexp expression expects the target expression and pattern to be a string, if it's not, we add a cast function. func (v *typeInferrer) handleRegexpExpr(x *ast.PatternRegexpExpr) { x.SetType(types.NewFieldType(mysql.TypeLonglong)) x.Type.Charset = charset.CharsetBin x.Type.Collate = charset.CollationBin x.Expr = v.addCastToString(x.Expr) x.Pattern = v.addCastToString(x.Pattern) }