pingcap/tidb

Float precision is different from MySQL

Open

#11,328 创建于 2019年7月18日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)Go (40,090 star) (6,186 fork)batch import
challenge-programcomponent/expressionhelp wantedsig/executiontype/compatibility

描述

Description

Bug Report

When insert into float column, the data precision is not consistent with mysql.

The mysql default float precision is 6 and tidb is 8.

  1. What did you do?
create table t (t float);
insert into t values(0.12345678912345); 
  1. What did you expect to see? In Mysql 5.7
mysql> select * from t;
+----------+
| t        |
+----------+
| 0.123457 |
+----------+
  1. What did you see instead?

In TiDB v3.0.0

tidb> select * from t;
+------------+
| t          |
+------------+
| 0.12345679 |
+------------+
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
tidb> select tidb_version();
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                              |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v3.0.0
Git Commit Hash: 60965b006877ca7234adaced7890d7b029ed1306
Git Branch: HEAD
UTC Build Time: 2019-06-28 12:14:07
GoVersion: go version go1.12 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

SIG slack channel

#sig-exec

Score

300

Mentor

  • @lzmhhh123

贡献者指南