[MDEV-455] Microseconds do not work in INTERVAL definition, a value with a fractional part gets rounded Created: 2012-08-15  Updated: 2012-08-29  Resolved: 2012-08-29

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.25
Fix Version/s: 5.5.27

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

I presume it also affects 5.3, but I didn't check.

create table t1 (d datetime(6));
insert into t1 values ('2012-12-12 00:00:00');
update t1 set d = adddate(d, interval 1.5 second);
select * from t1;

MySQL 5.6 result:

+----------------------------+
| d                          |
+----------------------------+
| 2012-12-12 00:00:01.500000 |
+----------------------------+

MariaDB result:

+----------------------------+
| d                          |
+----------------------------+
| 2012-12-12 00:00:02.000000 |
+----------------------------+

I think that MySQL result is reasonable for a server which supports fractional seconds, although https://kb.askmonty.org/en/microseconds-in-mariadb/ does not explicitly specify that microseconds support is supposed to work in this case.



 Comments   
Comment by Sergei Golubchik [ 2012-08-29 ]

It is intentional.
To create an interval with microseconds, one should use, for example
... + INTERVAL 1.5 SECOND_MICROSECOND
or any other interval type that supports microseconds, one of MINUTE_MICROSECOND, HOUR_MICROSECOND, DAY_MICROSECOND.

But for compatibility reasons we will support MySQL-5.6 behavior too, in MariaDB-10.x branch.

Generated at Thu Feb 08 06:28:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.