-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
types: support sql_mode ALLOW_INVALID_DATES #9027
Conversation
430756a
to
3af1c03
Compare
3af1c03
to
3259a81
Compare
Codecov Report
@@ Coverage Diff @@
## master #9027 +/- ##
==========================================
- Coverage 67.26% 67.26% -0.01%
==========================================
Files 371 371
Lines 76000 76009 +9
==========================================
+ Hits 51123 51128 +5
- Misses 20365 20367 +2
- Partials 4512 4514 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
runWithMode := func(mode string) { | ||
inputs := []string{"0000-00-00", "2019-00-00", "2019-01-00", "2019-00-01", "2019-02-31"} | ||
results := testkit.Rows(`0 0 0`, `2019 0 0`, `2019 1 0`, `2019 0 1`, `2019 2 31`) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should set the original sql_mode back after finishing this test, using defer in line 250.
PTAL @imtbkcat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
* sql: allow_invalid_dates is now supported via pingcap/tidb#9027 * Address PR Feedback
What problem does this PR solve?
support mode
ALLOW_INVALID_DATES
(fix #8263). With this mode enabled it will not perform full checking of dates. Check only that the month is in the range from 1 to 12 and the day is in the range from 1 to 31 (also allow zero values such as0000-00-00
).What is changed and how it works?
Add a new flag
AllowInvalidDate
intoStatementContext
. ThencheckMonthDay
check the month and day according to this flag.Check List
Tests
Code changes