pingcap / pingcap/tidb

union has a different result with mysql for overflowed integer

Open
#52,695 1 comment 0 reactions 1 assignee Claimed by @hawkingrei View on GitHub
severity/moderate sig/planner 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)

```
create table t1(a bigint);
create table t2(a bigint unsigned);
insert into t1 values(-1);
insert into t2 values(9223372036854775808); -- max signed bigint + 1;
select * from t1 union all select * from t2;
```

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

In MySQL:

```
mysql> select * from t1 union all select * from t2;
+---------------------+
| a |
+---------------------+
| -1 |
| 9223372036854775808 |
+---------------------+
2 rows in set (0.00 sec)
```

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

In tidb

```
> select * from t1 union all select * from t2;
+----------------------+
| a |
+----------------------+
| -1 |
| -9223372036854775808 |
+----------------------+
```

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

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.