TO_DAYS function returns incorrect value
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle |
Fix Released
|
Low
|
Mark Atwood |
Bug Description
In the crash-me test there is a check for TO_DAYS function. Drizzle is returning an incorrect value. The TO_DAYS function takes a date argument and is suppose to return the number of days since the year 0. Note that we should add a test to our test suite for this once this bug is fixed
drizzle> select to_days(
+------
| to_days(
+------
| 2450084 | <------ should be 729024
+------
1 row in set (0 sec)
drizzle> select to_days(
+------
| to_days(
+------
| 1721426 | <----- should be 366
+------
1 row in set (0 sec)
Related branches
- Drizzle Merge Team: Pending requested
-
Diff: 32 lines (+10/-2)1 file modifiedtests/sql-bench/crash-me (+10/-2)
Changed in drizzle: | |
assignee: | nobody → Mark Atwood (fallenpegasus) |
importance: | Undecided → Low |
status: | Invalid → Confirmed |
Changed in drizzle: | |
status: | Confirmed → Fix Released |
When reworking temporal values, I got rid of the MySQL-specific TO_DAYS() behaviour (of having a fictitious "day zero") in favor of the behaviour exhibited by almost all other databases, including PostgreSQL: use the Julian Day Number, which is the number of days since -4713 B.C. MySQL believes that there is a "year 0", which there is not.
I believe this is more a documentation issue than a bug in the output of TO_DAYS()...