pingcap/tidb

unix_timestamp return worng result when input with fractional digits

Open

#6,981 opened on 2018年7月4日

GitHub で見る
 (8 comments) (0 reactions) (0 assignees)Go (40,090 stars) (6,186 forks)batch import
component/expressionhelp wantedpriority/P4type/compatibility

説明

  1. What did you do? If possible, provide a recipe for reproducing the error.
mysql -P3306 -h127.0.0.1 -uroot -proot --column-type-info test;

mysql> select unix_timestamp('2011:01:01.001');
  1. What did you expect to see?
Field   1:  `unix_timestamp('2011:01:01.001')`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       LONGLONG
Collation:  binary (63)
Length:     11
Max_length: 10
Decimals:   0
Flags:      NOT_NULL BINARY NUM 

+----------------------------------+
| unix_timestamp('2011:01:01.001') |
+----------------------------------+
|                       1293814800 |
+----------------------------------+
1 row in set (0.00 sec)
  1. What did you see instead?
Field   1:  `unix_timestamp('2011:01:01.001')`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       NEWDECIMAL
Collation:  binary (63)
Length:     17
Max_length: 14
Decimals:   3
Flags:      BINARY NUM 


+----------------------------------+
| unix_timestamp('2011:01:01.001') |
+----------------------------------+
|                   1293811200.000 |
+----------------------------------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
Release Version: v2.1.0-beta-11-g1f6e12cc5
Git Commit Hash: 1f6e12cc55e534bf514eef212f1091a91b8592c9
Git Branch: HEAD
UTC Build Time: 2018-07-04 06:31:26
GoVersion: go version go1.10.1 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e

コントリビューターガイド