This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: convert dates outside of supported time range to correct date
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>
- Loading branch information
1 parent
c4a4af4
commit 4c888c4
Showing
2 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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