pingcap / pingcap/tidb

Query reports overflow

Open
#65,649 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

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
```sql

CREATE TABLE t0(c0 DOUBLE UNSIGNED NOT NULL DEFAULT 0.32945016401648164 , PRIMARY KEY(c0));
CREATE TABLE t1 LIKE t0;

REPLACE INTO t1(c0) VALUES (0.8663068278743247);
set @@tidb_projection_concurrency=80;
TRUNCATE t1;
ALTER TABLE t1 ORDER BY c0 DESC;
REPLACE LOW_PRIORITY INTO t1 VALUES (0.37568121068316096);
ALTER TABLE t0 DISABLE KEYS;
CREATE INDEX i50 ON t1(c0 DESC);
REPLACE HIGH_PRIORITY INTO t0 VALUES (0.34449549406373037), (NULL);

UPDATE t1 SET c0=t1.c0;
DELETE IGNORE FROM t1 LIMIT 1189328782;
INSERT IGNORE INTO t0(c0) VALUES (0.5568258887458463) ON DUPLICATE KEY UPDATE c0=(((CASE t0.c0 WHEN '-' THEN PI() ELSE 'm' END ))^((+ (t0.c0))));
REPLACE INTO t0(c0) VALUES (8.47807514E8), (0.8663068278743247);
REPLACE INTO t1(c0) VALUES (0.7522130074978514);
REPLACE INTO t0 VALUES (7.09995047E8);
REPLACE INTO t0(c0) VALUES (0.08193427149349142), (1.7976931348623157E308);
set @@tidb_opt_agg_push_down=1;
INSERT IGNORE INTO t0(c0) VALUES (0.6024570013636616);
SELECT t0.c0 FROM t0 WHERE CAST(t0.c0 AS DECIMAL);
```

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

Query executed successfully

### 3. What did you see instead (Required)
```sql
mysql> SELECT t0.c0 FROM t0 WHERE CAST(t0.c0 AS DECIMAL);
ERROR 1105 (HY000): [components/tidb_query_datatype/src/codec/mysql/decimal.rs:1916]: parsing 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 will overflow
```

### 4. What is your TiDB version? (Required)
```sql
8.0.11-TiDB-v9.0.0-beta.1.pre-640-g24903d6b24
```

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.