pingcap/tidb
在 GitHub 查看unix_timestamp return worng result when input with fractional digits
Open
#6,981 创建于 2018年7月4日
component/expressionhelp wantedpriority/P4type/compatibility
描述
- 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');
- 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)
- 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)
- What version of TiDB are you using (
tidb-server -Vor runselect 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