pingcap / pingcap/tidb

Incompatible behaviors with MySQL

Open
#63,109 0 comments 0 reactions 0 assignees View on GitHub
contribution 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 (c1 INT UNSIGNED);
INSERT INTO t1 VALUES (1);
SELECT (- (c1)) * ((c1) DIV (c1)) FROM t1; -- {18446744073709551615}
```
### 2. What did you expect to see? (Required)
The same behavior in MySQL.
### 3. What did you see instead (Required)
I got the following result in MySQL 8.4.6
```sql
CREATE TABLE t1 (c1 INT UNSIGNED);
INSERT INTO t1 VALUES (1);
SELECT (- (c1)) * ((c1) DIV (c1)) FROM t1; -- ERROR 1690 (22003): BIGINT UNSIGNED value is out of range
```
### 4. What is your TiDB version? (Required)

Release Version: v8.5.3
Edition: Community
Git Commit Hash: dc2548aac79a712265e831cff2a3a896bc0a5a38
Git Branch: HEAD
UTC Build Time: 2025-07-31 13:54:43
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.