This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
sql: convert dates outside of supported time range to correct date #694
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.
According to MySQL, dates should range between 1000-01-01 00:00:00
and 9999-12-31 23:59:59. This PR changes the behaviour of Convert
methods of Timestamp and Date types so that values returned by this
method are always within that range.
It also adds an exposed utility function named
ToSupportedTimeRange
that converts a time to the supported time range for clients to use.
The readme now includes instructions for datasource implementors to
always return their dates within the supported range using the
provided utility function.
The reason go-mysql-server does not handle that for data sources by
default is because there is no obvious place to do so in a generic
way. Tables should be the ones returning correct values.
Signed-off-by: Miguel Molina miguel@erizocosmi.co