pingcap / pingcap/tidb

SELECT reports parsing error

Open
#61,947 1 comment 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 CHAR UNIQUE );
CREATE TABLE t1(c0 TEXT(309) , c1 BOOL UNSIGNED );
INSERT IGNORE INTO t1 VALUES ('{ae', 607450541) ON DUPLICATE KEY UPDATE c0=',';

CREATE TABLE tt0(c0 char(1) COLLATE "utf8mb4_bin");
INSERT INTO tt0 SELECT * FROM t0;
CREATE TABLE tt1(c0 text COLLATE "utf8mb4_bin",c1 tinyint(1) unsigned);
INSERT INTO tt1 SELECT * FROM t1;

SELECT tt1.c0, tt1.c1, tt0.c0 FROM tt1, tt0 WHERE CAST(EXP(tt1.c1) AS DECIMAL);
```

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

SELECT executed successfully

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

```sql
ERROR 1105 (HY000): [components/tidb_query_datatype/src/codec/mysql/decimal.rs:1916]: parsing 556023164772767570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 will overflow
```

### 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

Research direction

Start by running the supplied SQL reproduction on the reported TiDB version, then inspect components/tidb_query_datatype/src/codec/mysql/decimal.rs around line 1916. The work is done when this SELECT executes successfully without the decimal overflow parsing error, with coverage for the reproduction case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.