pingcap / pingcap/tidb

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

Open
#37,981 2 comments 0 reactions 1 assignee Claimed by @xzhangxian1008 View on GitHub
affects-6.3 affects-6.4 affects-6.5 affects-6.6 affects-7.0 affects-7.1 affects-7.5 affects-8.1 may-affects-4.0 may-affects-5.0 may-affects-5.1 may-affects-5.2 may-affects-5.3 may-affects-5.4 may-affects-6.0 may-affects-6.1 may-affects-6.2 severity/major sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
```sql
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)
```sql
+--------------------------------------+---------------------------+
| regexp_replace(stra, '\\d', 'aaaaa') | regexp_instr(strb, '\\w') |
+--------------------------------------+---------------------------+
| aaaaa | 1 |
+--------------------------------------+---------------------------+
```
### 3. What did you see instead (Required)
```sql
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)
```sql
| 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 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.