Bug #118638 FROM_DAYS() result with argument less than 366 is inconsistent
Submitted: 10 Jul 2025 21:27 Modified: 13 Mar 15:53
Reporter: Roy Lyseng Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[10 Jul 2025 21:27] Roy Lyseng
Description:
Function FROM_DAYS() with arguments less than 366, which represent dates in year 0 all return 0000-00-00.

How to repeat:
select from_days(1),from_days(365);

+--------------+----------------+
| from_days(1) | from_days(365) |
+--------------+----------------+
| 0000-00-00   | 0000-00-00     |
+--------------+----------------+

Suggested fix:
Let FROM_DAYS() return consistent results, ie. 0000-01-01 and 0000-12-31 in this case.
[13 Mar 15:53] Edward Gilmore
Posted by developer:
 
Added the following note to the MySQL Server 9.7.0 release notes:
		
FROM_DAYS() did not handle out of range values, or values less than 366, consistently.