pingcap/tidb

Float precision is different from MySQL

Open

#11,328 opened on Jul 18, 2019

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Go (6,186 forks)batch import
challenge-programcomponent/expressionhelp wantedsig/executiontype/compatibility

Repository metrics

Stars
 (40,090 stars)
PR merge metrics
 (Avg merge 14d 4h) (346 merged PRs in 30d)

Description

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

Contributor guide