pingcap/tidb

Float precision is different from MySQL

Open

#11.328 aperta il 18 lug 2019

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Go (6186 fork)batch import
challenge-programcomponent/expressionhelp wantedsig/executiontype/compatibility

Metriche repository

Star
 (40.090 star)
Metriche merge PR
 (Merge medio 14g 4h) (346 PR mergiate in 30 g)

Descrizione

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

Guida contributor