Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regular expression REGEXP is case-sensitive in TiDB which is not in MySQL #4337

Closed
tshqin opened this issue Aug 27, 2017 · 1 comment · Fixed by #4331
Closed

regular expression REGEXP is case-sensitive in TiDB which is not in MySQL #4337

tshqin opened this issue Aug 27, 2017 · 1 comment · Fixed by #4331

Comments

@tshqin
Copy link
Contributor

tshqin commented Aug 27, 2017

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
create table t (a char(10), b varchar(10), c binary(10), d varbinary(10));
insert into t values ('text','text','text','text');

mysql> desc t;
+-------+---------------+------+-----+---------+-------+
| Field | Type          | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| a     | char(10)      | YES  |     | NULL    |       |
| b     | varchar(10)   | YES  |     | NULL    |       |
| c     | binary(10)    | YES  |     | NULL    |       |
| d     | varbinary(10) | YES  |     | NULL    |       |
+-------+---------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql> select * from t;
+------+------+------------+------+
| a    | b    | c          | d    |
+------+------+------------+------+
| text | text | text       | text |
+------+------+------------+------+
1 row in set (0.00 sec)
  1. What did you expect to see?

MySQL

mysql> select * from t where a REGEXP 'Xt' =1;
+------+------+------------+------+
| a    | b    | c          | d    |
+------+------+------------+------+
| text | text | text       | text |
+------+------+------------+------+
1 row in set (0.00 sec)

mysql> select * from t where b REGEXP 'Xt' =1;
+------+------+------------+------+
| a    | b    | c          | d    |
+------+------+------------+------+
| text | text | text       | text |
+------+------+------------+------+
1 row in set (0.00 sec)

mysql> select * from t where c REGEXP 'Xt' =1;
Empty set (0.00 sec)

mysql> select * from t where d REGEXP 'Xt' =1;
Empty set (0.00 sec)
  1. What did you see instead?

TiDB

MySQL [gin]> select * from t where a REGEXP 'Xt' =1;
Empty set (0.00 sec)

MySQL [gin]> select * from t where b REGEXP 'Xt' =1;
Empty set (0.00 sec)

MySQL [gin]> select * from t where c REGEXP 'Xt' =1;
Empty set (0.00 sec)

MySQL [gin]> select * from t where d REGEXP 'Xt' =1;
Empty set (0.00 sec)

MySQL [gin]> select * from t where a REGEXP '[Xt]' =1;
+------+------+------------+------+
| a    | b    | c          | d    |
+------+------+------------+------+
| text | text | text       | text |
+------+------+------------+------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V)?
    Git Commit Hash: 365e4ab
    Git Commit Branch: master
    UTC Build Time: 2017-08-16 01:24:27
@zz-jason
Copy link
Member

thanks for your feed back, REGEXP is rewritten in #4331.
to #4080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants