pingcap / pingcap/tidb

Query reports overflow in TiDB but not in MySQL

Open
#55,397 2 comments 0 reactions 0 assignees View on GitHub
affects-8.5 component/coprocessor may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major 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 t1(c0 DOUBLE DEFAULT -2.032393529E9 );
INSERT INTO t1(c0) VALUES (1.7976931348623157E90);
SELECT t1.c0 FROM t1 WHERE (CASE ((-208665085)REGEXP(CAST(0.6831809677297028 AS DECIMAL))) WHEN DEFAULT(t1.c0) THEN ((t1.c0) IS NULL) ELSE CAST(t1.c0 AS DECIMAL) END );
```

### 2. What did you expect to see? (Required)
```sql
+-----------------------+
| c0 |
+-----------------------+
| 1.7976931348623157e90 |
+-----------------------+
```

### 3. What did you see instead (Required)
```sql
ERROR 1105 (HY000): [components/tidb_query_datatype/src/codec/mysql/decimal.rs:1916]: parsing 1797693134862315700000000000000000000000000000000000000000000000000000000000000000000000000 will overflow
```

### 4. What is your TiDB version? (Required)
```sql
Release Version: v8.3.0-alpha-50-gb59f5ecb47-dirty
Edition: Community
Git Commit Hash: b59f5ecb472d831f867b079e0a409caef9f4a290
Git Branch: master
UTC Build Time: 2024-07-31 18:41:32
GoVersion: go1.22.5
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.