Skip to content

TIME() function infers precision based off input #11944

Description

@jycor

Depending on the input, TIME() is able to infer the required precision.
Currently, we always assume max precision (6)

mysql> select time('12:34:56.123456');
Field   1:  `time('12:34:56.123456')`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       TIME
Collation:  binary (63)
Length:     17
Max_length: 15
Decimals:   6
Flags:      BINARY 


+-------------------------+
| time('12:34:56.123456') |
+-------------------------+
| 12:34:56.123456         |
+-------------------------+
1 row in set (0.00 sec)

mysql> select time('12:34:56.1234');
Field   1:  `time('12:34:56.1234')`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       TIME
Collation:  binary (63)
Length:     15
Max_length: 13
Decimals:   4
Flags:      BINARY 


+-----------------------+
| time('12:34:56.1234') |
+-----------------------+
| 12:34:56.1234         |
+-----------------------+
1 row in set (0.00 sec)

Activity

  1. added
    bugSomething isn't working
    good reproEasily reproducible bugs
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood reproEasily reproducible bugs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions