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

regexp_like & regexp_instr result as the params of regexp_xxx will report an error #37981

Open
aytrack opened this issue Sep 20, 2022 · 2 comments
Assignees
Labels
affects-6.3 affects-6.4 affects-6.5 affects-6.6 affects-7.0 affects-7.1 affects-7.5 affects-8.1 affects-8.5 may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@aytrack
Copy link
Contributor

aytrack commented Sep 20, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a varchar(100), b varchar(50), c text, d char(10));
with cte1 as (with cte2 as (select regexp_like(a, '\\d') as stra, regexp_substr(c, '\\w') strb from t) select * from cte2) select regexp_replace(stra, '\\d', 'aaaaa'), regexp_instr(strb, '\\w') from cte1;

2. What did you expect to see? (Required)

+--------------------------------------+---------------------------+
| regexp_replace(stra, '\\d', 'aaaaa') | regexp_instr(strb, '\\w') |
+--------------------------------------+---------------------------+
| aaaaa                                |                         1 |
+--------------------------------------+---------------------------+

3. What did you see instead (Required)

mysql> with cte1 as (with cte2 as (select regexp_like(a, '\\d') as stra, regexp_substr(c, '\\w') strb from t) select * from cte2) select regexp_replace(stra, '\\d', 'aaaaa'), regexp_instr(strb, '\\w') from cte1;
ERROR 1139 (42000): Got error 'Not support binary collation so far' from regexp

4. What is your TiDB version? (Required)

| tidb_version()                                                                                                                                                                                                                                                                                             |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.3.0-alpha
Edition: Community
Git Commit Hash: 29f83a0b25926390c757f71a84baa2322a289f78
Git Branch: heads/refs/tags/v6.3.0-alpha
UTC Build Time: 2022-09-18 14:25:04
GoVersion: go1.19
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@aytrack aytrack added type/bug The issue is confirmed as a bug. sig/execution SIG execution severity/major labels Sep 20, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 labels Sep 20, 2022
@dveeden
Copy link
Contributor

dveeden commented Apr 4, 2024

With TiDB v8.0.0 this happens:

tidb> SELECT REGEXP_INSTR(NULL, NULL);
ERROR 1139 (42000): Got error 'Not support binary collation so far' from regexp

MySQL 8.3.0 returns NULL for the same query.

@aytrack , @xzhangxian1008 do you think this is the same issue?

@xzhangxian1008
Copy link
Contributor

With TiDB v8.0.0 this happens:

tidb> SELECT REGEXP_INSTR(NULL, NULL);
ERROR 1139 (42000): Got error 'Not support binary collation so far' from regexp

MySQL 8.3.0 returns NULL for the same query.

@aytrack , @xzhangxian1008 do you think this is the same issue?

Yes, it's the same issue.

create table test1 (c1 varchar(10), c2 varchar(10));
insert into test1 values (null, null); 
select regexp_instr(c1, c2) from test1; # It will return null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.3 affects-6.4 affects-6.5 affects-6.6 affects-7.0 affects-7.1 affects-7.5 affects-8.1 affects-8.5 may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

6 participants