pingcap / pingcap/tidb

Incompatible Results for GREATEST Function

Open
#53,694 0 comments 1 reaction 0 assignees View on GitHub
compatibility-mysql80 severity/minor sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

There is a compatibility issue between TiDB and MySQL 8 when using the GREATEST function.

### 1. Minimal reproduce step (Required)

Set up the table:

```sql
CREATE TABLE t0 (c_0 DOUBLE, c_1 TEXT, c_2 DOUBLE);
INSERT INTO t0 VALUES (8.127934079803597e+27, 633230464, 8.127934079803597e+27);
```

Execute the following query:

```sql
SELECT (GREATEST(t0.c_0, t0.c_1)) FROM t0;
```

Observed Results:

MySQL8 returns 8.127934079803597e27 and TiDB returns 8127934079803597000000000000

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

The query returns the same result in both MySQL 8 and TiDB.

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

See part 1.

### 4. What is your TiDB version? (Required)

Release Version: v7.5.1
Edition: Community
Git Commit Hash: 7d16cc79e81bbf573124df3fd9351c26963f3e70
Git Branch: heads/refs/tags/v7.5.1
UTC Build Time: 2024-02-27 14:30:59
GoVersion: go1.21.6
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.