pingcap/tidb

Float precision is different from MySQL

Open

#11.328 geöffnet am 18. Juli 2019

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Go (6.186 Forks)batch import
challenge-programcomponent/expressionhelp wantedsig/executiontype/compatibility

Repository-Metriken

Stars
 (40.090 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 14T 4h) (346 gemergte PRs in 30 T)

Beschreibung

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