pingcap / pingcap/tidb

TiDB Throws ERROR 1105 on DATEDIFF with CONCAT_WS and BIT Field

Open
#67,002 2 comments 0 reactions 0 assignees View on GitHub
contribution severity/moderate sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)
```sql
DROP TABLE IF EXISTS table2;
CREATE TABLE table2 (count INT, status BIT, timestamp DATETIME);
INSERT INTO table2(count, status, timestamp)
VALUES(100, 1, '2023-12-01 10:00:00');
SELECT DATEDIFF(CONCAT_WS(100, 100, tom12.status), tom12.timestamp) AS c11
FROM table2 AS tom12;
--ERROR 1105 (HY000): expected integer
SELECT DATEDIFF(CONCAT_WS(100, 100, 1), tom12.timestamp) AS c11
FROM table2 AS tom12;
--
+------+
| c11 |
+------+
| NULL |
+------+
1 row in set, 1 warning (0.00 sec)
```
### 2. What did you expect to see? (Required)
I expected both queries to return similar results, as tom12.status is 1 .

### 3. What did you see instead (Required)
The first query throws an error: ERROR 1105 (HY000): expected integer.

The second query returns NULL with one warning, which is the expected behavior due to invalid date format or concatenation.
### 4. What is your TiDB version? (Required)

Release Version: v8.5.5
Edition: Community
Git Commit Hash: 1fa258b833ff113883beeba40bc130be7ce66610
Git Branch: HEAD
UTC Build Time: 2026-03-12 08:34:59
GoVersion: go1.25.5
Race Enabled: false
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.