`CONCAT(...)` reports `Incorrect string value` for expression
- 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!
The same query does not trigger such an error on MySQL and MariaDB.
TiDB should not return an assertion failure to the user.
### 1. Minimal reproduce step (Required)
```sql
CREATE TABLE t0(c0 TEXT(97));
REPLACE INTO t0(c0) VALUES ('+%o');
SELECT ref0
FROM (
SELECT CONCAT(
t0.c0,
INET6_ATON(CHAR(0.10720270255669206)) AND
(CASE ((t0.c0) << (-638857355))
WHEN (CASE t0.c0
WHEN 1056566955 THEN -2046596771
ELSE '9+*H2lg'
END)
THEN 'e'
WHEN t0.c0 THEN ((t0.c0) | (t0.c0))
ELSE t0.c0
END)
) AS ref0,
(NOT ('0')) AS ref1
FROM t0
) AS s
WHERE ref1;
```
### 2. What did you expect to see? (Required)
```shell
mysql> SELECT ref0 FROM (SELECT CONCAT(t0.c0, INET6_ATON(CHAR(0.10720270255669206)) AND (CASE ((t0.c0)<<(-638857355)) WHEN (CASE t0.c0 WHEN 1056566955 THEN -2046596771 ELSE '9+*H2lg' END ) THEN 'e' WHEN t0.c0 THEN ((t0.c0)|(t0.c0)) ELSE t0.c0 END )) AS ref0, (NOT ('0')) AS ref1 FROM t0) AS s WHERE ref1;
+------+
| ref0 |
+------+
| +%o0 |
+------+
1 row in set, 2 warnings (0.00 sec)
```
### 3. What did you see instead (Required)
```shell
mysql> SELECT ref0 FROM (SELECT CONCAT(t0.c0, INET6_ATON(CHAR(0.10720270255669206)) AND (CASE ((t0.c0)<<(-638857355)) WHEN (CASE t0.c0 WHEN 1056566955 THEN -2046596771 ELSE '9+*H2lg' END ) THEN 'e' WHEN t0.c0 THEN ((t0.c0)|(t0.c0)) ELSE t0.c0 END )) AS ref0, (NOT ('0')) AS ref1 FROM t0) AS s WHERE ref1;
ERROR 1411 (HY000): Incorrect string value: '
```
### 4. What is your TiDB version? (Required)
```shell
mysql> select tidb_version();
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.5.5
Edition: Community
Git Commit Hash: 1fa258b833ff113883beeba40bc130be7ce66610
Git Branch: HEAD
UTC Build Time: 2026-01-14 22:20:57
GoVersion: go1.25.5
Race Enabled: false
Check Table Before Drop: false
Store: unistore |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
```
Contributor guide
Assessment
This issue has not been assessed yet.