pingcap/tidb

Float precision is different from MySQL

Open

#11 328 ouverte le 18 juil. 2019

Voir sur GitHub
 (4 commentaires) (0 réactions) (0 assignés)Go (6 186 forks)batch import
challenge-programcomponent/expressionhelp wantedsig/executiontype/compatibility

Métriques du dépôt

Stars
 (40 090 stars)
Métriques de merge PR
 (Merge moyen 14j 4h) (346 PRs mergées en 30 j)

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

Guide contributeur