Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Trivial
-
Resolution: Won't Fix
-
Affects Version/s: 5.5.25
-
Fix Version/s: 5.5.31
-
Component/s: None
-
Labels:None
Description
I presume it affects 5.3 too, but I didn't check. In any case, I am not sure it's worth changing, since no harm is done, but it differs from the doc (https://kb.askmonty.org/en/microseconds-in-mariadb/) which says that the precision is an INTEGER number, so I thought it makes sense to check.
Normally the syntax for microseconds precision doesn't allow anything but digits, but it makes an exception for a decimal points. A precision value with a fractional part is truncated.
create table t1 (f time(5.8));
# Query OK, 0 rows affected (0.14 sec)
show create table t1;
# +-------+---------------------------------------------------------------------------------------+
# | Table | Create Table |
# +-------+---------------------------------------------------------------------------------------+
# | t1 | CREATE TABLE `t1` (
# `f` time(5) DEFAULT NULL
# ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
# +-------+---------------------------------------------------------------------------------------+
select cast('12:12:12.12' as time(0.5));
# +----------------------------------+
# | cast('12:12:12.12' as time(0.5)) |
# +----------------------------------+
# | 12:12:12 |
# +----------------------------------+
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
I'm not sure what to choose.
A complex 100% correct solution is not worth the troubles.
Out of easy ones, we can either allow decimal dot in the field's precision: CREATE TABLE t1 (a TIME(1.5));
Or prohibit huge precisions like CREATE TABLE t1 (a TIME(99999999999999999999999999999999999));
Neither syntax makes a lot of sense, and probably neither is used by anyone. The second is always an error (too large precision). In the first - precision is always rounded down.