pingcap / pingcap/tidb

SELECT reports error in TiDB but not in MySQL

Open
#61,946 2 comments 0 reactions 0 assignees View on GitHub
severity/moderate 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 t0(c0 DECIMAL UNSIGNED ZEROFILL , c1 NUMERIC , c2 TEXT(310) );
INSERT IGNORE INTO t0(c2, c0, c1) VALUES (-837020673, 2111813582, 2111813582);

CREATE TABLE t1(c0 decimal(10,0) unsigned zerofill,c1 text COLLATE "utf8mb4_bin",c2 text COLLATE "utf8mb4_bin");
INSERT INTO t1 SELECT * FROM t0;
SELECT t1.c2, t1.c0, t1.c1 FROM t1 WHERE (CASE 1339410646 WHEN CAST(EXPORT_SET(CEILING((- (t1.c2))), (~ (false)), t1.c0, 0.4071873864608775, t1.c2) AS DATETIME) THEN (CASE 0.8171327018587662 WHEN t1.c0 THEN 'e' ELSE t1.c1 END ) ELSE (('.)')OR('(')) END );
```

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

SELECT executed successfully

### 3. What did you see instead (Required)

```sql
ERROR 1105 (HY000): strconv.Atoi: parsing "184467440737095516150": value out of range
```

### 4. What is your TiDB version? (Required)
```sql
Release Version: v9.0.0-beta.1.pre-640-g24903d6b24
Edition: Community
Git Commit Hash: 24903d6b24674b9a43625ac2d05bf1b033b04407
Git Branch: master
UTC Build Time: 2025-04-27 01:17:32
GoVersion: go1.23.8
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```

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.