MySQL: Fix zero-value YEAR decoding, improve user docs around zero-value date/time types#36649
Open
martykulma wants to merge 4 commits into
Open
MySQL: Fix zero-value YEAR decoding, improve user docs around zero-value date/time types#36649martykulma wants to merge 4 commits into
martykulma wants to merge 4 commits into
Conversation
kay-kim
reviewed
May 21, 2026
| 4 "1901" | ||
| 5 "2155" | ||
| 6 "2025" | ||
| 7 "0" |
Contributor
Author
There was a problem hiding this comment.
Thanks for running it! It should definitely be 0, and the reason the automated test didn't catch it is because it ran so fast, everything was read via the snapshot. I modified the test and now see the failure.
text-columns-year.td:76:1: error: non-matching rows: expected:
[["1", "2024"], ["10", "2155"], ["2", "0"], ["3", "<null>"], ["4", "1901"], ["5", "2155"], ["6", "2025"], ["7", "0"], ["8", "<null>"], ["9", "1901"]]
got:
[["1", "2024"], ["10", "2155"], ["2", "0"], ["3", "<null>"], ["4", "1901"], ["5", "2155"], ["6", "2025"], ["7", "1900"], ["8", "<null>"], ["9", "1901"]]
Poor diff:
- 7 0
+ 7 1900
kay-kim
approved these changes
May 21, 2026
86f9075 to
cbbdf7a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This started doc change and new test, but then @kay-kim uncovered a bug via manual testing! No we have a fix, which is included.
This PR fixes handling of zero-value YEAR
This also works around a mysql_common bug that treat zero-year binlog as 1900, which is an invalid year. It should be 0. See MySQL crazy set of rules for YEAR.
Additionally: