Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
10.0.4, 5.5.31, 5.3.12
-
None
-
None
Description
The function MAKETIME() in MariaDB does not preserve fractional digits:
MariaDB [test]> SELECT MAKETIME(10,10,10.231); |
+------------------------+ |
| MAKETIME(10,10,10.231) |
|
+------------------------+ |
| 10:10:10 |
|
+------------------------+ |
1 row in set (0.00 sec) |
It works as expected in MySQL-5.6:
MySQL [test]> SELECT MAKETIME(10,10,10.231); |
+------------------------+ |
| MAKETIME(10,10,10.231) |
|
+------------------------+ |
| 10:10:10.231 |
|
+------------------------+ |
1 row in set (0.00 sec) |
A possibly related problem:
MariaDB [test]> SELECT MAKETIME(0, 0, 59.9);
|
+----------------------+
|
| MAKETIME(0, 0, 59.9) |
|
+----------------------+
|
| NULL |
|
+----------------------+
|
The above result is wrong.
It seems 59.9 is rounded to 60, which makes a wrong time '00:00:60', hence NULL.
The expected result is '00:00:59.9'.
More examples:
MariaDB [test]> drop table if exists t1; create table t1 as select time('10:00:00'); show create table t1; |
Query OK, 0 rows affected (0.00 sec) |
Query OK, 1 row affected (0.10 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
+-------+------------------------------------------------------------------------------------------------------+ |
| Table | Create Table | |
+-------+------------------------------------------------------------------------------------------------------+ |
| t1 | CREATE TABLE `t1` ( |
`time('10:00:00')` time(6) DEFAULT NULL |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 | |
+-------+------------------------------------------------------------------------------------------------------+ |
1 row in set (0.00 sec) |
The expected column type is time(0).
Attachments
Issue Links
Activity
Field | Original Value | New Value |
---|---|---|
Assignee | Alexander Barkov [ bar ] |
Summary | MAKETIME does not preserve microseconds | Some temporal functions do not preserve microseconds |
Description |
The function MAKETIME() in MariaDB does not preserve fractional digits: {code:sql} MariaDB [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10 | +------------------------+ 1 row in set (0.00 sec) {code} It works as expected in MySQL-5.6: {code:sql} MySQL [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10.231 | +------------------------+ 1 row in set (0.00 sec) {code} |
The function MAKETIME() in MariaDB does not preserve fractional digits: {code:sql} MariaDB [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10 | +------------------------+ 1 row in set (0.00 sec) {code} It works as expected in MySQL-5.6: {code:sql} MySQL [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10.231 | +------------------------+ 1 row in set (0.00 sec) {code} More examples: {code:sql} MariaDB [test]> drop table if exists t1; create table t1 as select time('10:00:00'); show create table t1; Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.10 sec) Records: 1 Duplicates: 0 Warnings: 0 +-------+------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `time('10:00:00')` time(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) {code} The expected column type is time(0). |
Fix Version/s | 10.0.5 [ 13201 ] | |
Fix Version/s | 5.5.33 [ 13300 ] |
Description |
The function MAKETIME() in MariaDB does not preserve fractional digits: {code:sql} MariaDB [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10 | +------------------------+ 1 row in set (0.00 sec) {code} It works as expected in MySQL-5.6: {code:sql} MySQL [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10.231 | +------------------------+ 1 row in set (0.00 sec) {code} More examples: {code:sql} MariaDB [test]> drop table if exists t1; create table t1 as select time('10:00:00'); show create table t1; Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.10 sec) Records: 1 Duplicates: 0 Warnings: 0 +-------+------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `time('10:00:00')` time(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) {code} The expected column type is time(0). |
The function MAKETIME() in MariaDB does not preserve fractional digits: {code:sql} MariaDB [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10 | +------------------------+ 1 row in set (0.00 sec) {code} It works as expected in MySQL-5.6: {code:sql} MySQL [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10.231 | +------------------------+ 1 row in set (0.00 sec) {code} {code} MariaDB [test]> SELECT MAKETIME(0, 0, 59.9); +----------------------+ | MAKETIME(0, 0, 59.9) | +----------------------+ | NULL | +----------------------+ {code} The above result is wrong. It seems 59.9 is rounded to 60, which makes a wrong time '00:00:60', hence NULL. The expected result is '00:00:59.9'. More examples: {code:sql} MariaDB [test]> drop table if exists t1; create table t1 as select time('10:00:00'); show create table t1; Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.10 sec) Records: 1 Duplicates: 0 Warnings: 0 +-------+------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `time('10:00:00')` time(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) {code} The expected column type is time(0). |
Description |
The function MAKETIME() in MariaDB does not preserve fractional digits: {code:sql} MariaDB [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10 | +------------------------+ 1 row in set (0.00 sec) {code} It works as expected in MySQL-5.6: {code:sql} MySQL [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10.231 | +------------------------+ 1 row in set (0.00 sec) {code} {code} MariaDB [test]> SELECT MAKETIME(0, 0, 59.9); +----------------------+ | MAKETIME(0, 0, 59.9) | +----------------------+ | NULL | +----------------------+ {code} The above result is wrong. It seems 59.9 is rounded to 60, which makes a wrong time '00:00:60', hence NULL. The expected result is '00:00:59.9'. More examples: {code:sql} MariaDB [test]> drop table if exists t1; create table t1 as select time('10:00:00'); show create table t1; Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.10 sec) Records: 1 Duplicates: 0 Warnings: 0 +-------+------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `time('10:00:00')` time(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) {code} The expected column type is time(0). |
The function MAKETIME() in MariaDB does not preserve fractional digits: {code:sql} MariaDB [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10 | +------------------------+ 1 row in set (0.00 sec) {code} It works as expected in MySQL-5.6: {code:sql} MySQL [test]> SELECT MAKETIME(10,10,10.231); +------------------------+ | MAKETIME(10,10,10.231) | +------------------------+ | 10:10:10.231 | +------------------------+ 1 row in set (0.00 sec) {code} A possibly related problem: {code} MariaDB [test]> SELECT MAKETIME(0, 0, 59.9); +----------------------+ | MAKETIME(0, 0, 59.9) | +----------------------+ | NULL | +----------------------+ {code} The above result is wrong. It seems 59.9 is rounded to 60, which makes a wrong time '00:00:60', hence NULL. The expected result is '00:00:59.9'. More examples: {code:sql} MariaDB [test]> drop table if exists t1; create table t1 as select time('10:00:00'); show create table t1; Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.10 sec) Records: 1 Duplicates: 0 Warnings: 0 +-------+------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `time('10:00:00')` time(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) {code} The expected column type is time(0). |
Priority | Minor [ 4 ] | Major [ 3 ] |
Priority | Major [ 3 ] | Minor [ 4 ] |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Workflow | defaullt [ 27768 ] | MariaDB v2 [ 44612 ] |
Workflow | MariaDB v2 [ 44612 ] | MariaDB v3 [ 61757 ] |
Workflow | MariaDB v3 [ 61757 ] | MariaDB v4 [ 146818 ] |