Skip to content

We don't correctly convert datetime, date, and time types to numbers #10278

@angelamayxie

Description

@angelamayxie

In MySQL, datetime, date, and time values convert to number values by concatenating the datetime fields without any separators. For example date('2020-12-15') converts to 20201215 and time('12:34:54') converts to 123454.

We use the time.UTC().Unix to convert datetime values to numbers, which is not correct. select cast(now() as signed in MySQL returns 20260106142016 while it returns 1767708857 in Dolt.

For date values, it seems like we convert it to a string and then truncate. As a result, only the year ends up converting.

It seems like for time values, we don't support converting to numbers at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcorrectnessWe don't return the same result as MySQL

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions