Bug #61193 incorrect rounding of date DECIMAL(17,3)
| Submitted: | 16 May 2011 22:49 | Modified: | 14 Dec 2025 17:57 |
|---|---|---|---|
| Reporter: | leo strashnoy | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
| Version: | 5.1.58, 5.5 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | 3), date DECIMAL(17 | ||
[16 May 2011 22:49]
leo strashnoy
[17 May 2011 3:15]
Valeriy Kravchuk
Verified with 5.1.58 on Mac:
macbook-pro:5.1 openxs$ bin/mysql -uroot -P3306 --host=127.0.0.1 test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.58-debug Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select time(20110512154559.616),
-> date(20110512154559.616),
-> date(floor(20110512154559.616));
+--------------------------+--------------------------+---------------------------------+
| time(20110512154559.616) | date(20110512154559.616) | date(floor(20110512154559.616)) |
+--------------------------+--------------------------+---------------------------------+
| 15:45:59.616000 | NULL | 2011-05-12 |
+--------------------------+--------------------------+---------------------------------+
1 row in set, 1 warning (0.08 sec)
mysql> show warnings\G
*************************** 1. row ***************************
Level: Warning
Code: 1292
Message: Incorrect datetime value: '20110512154560'
1 row in set (0.02 sec)
Looks inconsistent (time() vs date() behavior) and, thus, a bug.
[17 May 2011 15:57]
leo strashnoy
The problem is the rounding for the dates. I hope you have a patch for that. Meanwhile can I overload function like this: CREATE FUNCTION test.date(p1 decimal(17,3)) RETURNS date NO SQL RETURN date(floor(p1)) ;
[14 Dec 2025 17:57]
Roy Lyseng
Posted by developer: Not reproducible in version 8.0 and later.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.