Get an error when convert binary to utf8mb4 in some builtin func for json type
- 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)
```
create table t ( d json);
insert into t values ('{\"abcABC一二三abcABC\": \"abcABC一二 三abcABC\"}');
select position(d in 0xe2e212e2e2) from t;
select instr(0xe2e212e2e2, d) from t;
```
### 2. What did you expect to see? (Required)
```
mysql> select position(d in 0xe2e212e2e2) from t;
+-----------------------------+
| position(d in 0xe2e212e2e2) |
+-----------------------------+
| 0 |
+-----------------------------+
1 row in set (0.00 sec)
mysql> select instr(0xe2e212e2e2, d) from t;
+------------------------+
| instr(0xe2e212e2e2, d) |
+------------------------+
| 0 |
+------------------------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
```
tidb> select position(d in 0xe2e212e2e2) from t;
ERROR 3854 (HY000): Cannot convert string '\xE2\xE2\xE2\xE2' from binary to utf8mb4
tidb> select instr(0xe2e212e2e2, d) from t;
ERROR 3854 (HY000): Cannot convert string '\xE2\xE2\xE2\xE2' from binary to utf8mb4
```
### 4. What is your TiDB version? (Required)
```
Release Version: v6.0.0-dirty
Edition: Community
Git Commit Hash: 36a9810441ca0e496cbd22064af274b3be771081
```
Contributor guide
Assessment
This issue has not been assessed yet.