[MDEV-10173] Wrong value for decimals in metadata Created: 2016-06-03  Updated: 2017-11-15  Resolved: 2017-11-15

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.2
Fix Version/s: 10.2.11

Type: Bug Priority: Major
Reporter: Georg Richter Assignee: Alexey Botchkov
Resolution: Not a Bug Votes: 0
Labels: None

Sprint: 10.2.10, 10.2.11

 Description   

This bug occurs when running 10.2 testsuite with Connector/C:
perl mysql-test-run func_time --ps-protocol

When a string value, e.g "0" rather than number, is passed to from_unixtime() function the number of decimals is wrong (31 instead of 0). Also length value is not correct.

How to repeat:

MariaDB [test]> select from_unixtime(0), from_unixtime("0");
Field   1:  `from_unixtime(0)`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       DATETIME
Collation:  binary (63)
Length:     19
Max_length: 19
Decimals:   0
Flags:      BINARY 
 
Field   2:  `from_unixtime("0")`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       DATETIME
Collation:  binary (63)
Length:     26  <----- ????
Max_length: 19
Decimals:   31 <---- ????
Flags:      BINARY 
 
 
+---------------------+---------------------+
| from_unixtime(0)    | from_unixtime("0")  |
+---------------------+---------------------+
| 1970-01-01 01:00:00 | 1970-01-01 01:00:00 |
+---------------------+---------------------+
1 row in set (0.00 sec)



 Comments   
Comment by Alexey Botchkov [ 2017-11-15 ]

The 'Length 26' is the correct value. The 'Decimals 31' means that we don't know the exact precision. So the client just should handle this properly.

Generated at Thu Feb 08 07:40:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.