pingcap / pingcap/tidb

insert value -1e3 and -1000 into bit column, return different results

Open
#60,731 0 comments 0 reactions 0 assignees View on GitHub
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)

drop table t;
CREATE TABLE t (b BIT);
INSERT /*! IGNORE */ INTO t VALUES (-1000);
INSERT /*! IGNORE */ INTO t VALUES (-1e3);
INSERT /*! IGNORE */ INTO t VALUES ('-1e3');
SELECT b+0 FROM t;

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

results from mysql:

MySQL [test2]> SELECT b+0 FROM t;
+------+
| b+0 |
+------+
| 1 |
| 1 |
| 1 |
+------+
3 rows in set (0.00 sec)
MySQL [test2]> select version();
+-----------+
| version() |
+-----------+
| 8.4.3 |
+-----------+
1 row in set (0.00 sec)

### 3. What did you see instead (Required)
results from tidb:
MySQL [test1]> SELECT b+0 FROM t;
+------+
| b+0 |
+------+
| 1 |
| 0 |
| 1 |
+------+
3 rows in set (0.00 sec)

### 4. What is your TiDB version? (Required)
MySQL [test2]> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.5.1
Edition: Community
Git Commit Hash: fea86c8e35ad4a86a5e1160701f99493c2ee547c
Git Branch: HEAD
UTC Build Time: 2025-01-16 07:38:34
GoVersion: go1.23.4
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MySQL [test2]>

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.