Skip to content
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: invalid year should be 0 #12715

Merged
merged 3 commits into from
Oct 16, 2019
Merged

Conversation

cyliu0
Copy link
Contributor

@cyliu0 cyliu0 commented Oct 15, 2019

What problem does this PR solve?

Invalid year should be "0000". Fix #12615

What is changed and how it works?

Return 0 with error in convertToMysqlYear

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
mysql> create table t (y year);
Query OK, 0 rows affected (0.01 sec)

mysql> insert ignore into t values(2156);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert ignore into t values(999999999999999999999999999);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert ignore into t values(1900);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert ignore into t values(1900.5);
Query OK, 1 row affected (0.00 sec)

mysql> select * from t;
+------+
| y    |
+------+
| 0000 |
| 0000 |
| 0000 |
| 1901 |
+------+
4 rows in set (0.00 sec)

Related changes

  • Need to cherry-pick to the release branch

Release note

  • Fix YEAR compatibility, inserting invalid year value will be "0000"

@cyliu0 cyliu0 requested a review from lzmhhh123 October 15, 2019 07:28
@codecov
Copy link

codecov bot commented Oct 15, 2019

Codecov Report

Merging #12715 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #12715   +/-   ##
===========================================
  Coverage   79.8869%   79.8869%           
===========================================
  Files           462        462           
  Lines        105036     105036           
===========================================
  Hits          83910      83910           
  Misses        14923      14923           
  Partials       6203       6203

Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lzmhhh123 lzmhhh123 added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 15, 2019
@lzmhhh123 lzmhhh123 requested a review from wshwsh12 October 15, 2019 11:13
Copy link
Contributor

@wshwsh12 wshwsh12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wshwsh12 wshwsh12 added component/expression status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. needs-cherry-pick-2.1 status/can-merge Indicates a PR has been approved by a committer. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 15, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 15, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Oct 15, 2019

@cyliu0 merge failed.

@zz-jason
Copy link
Member

/run-integration-common-test

@zz-jason
Copy link
Member

/run-integration-common-test

@ngaut ngaut merged commit e168fd9 into pingcap:master Oct 16, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 16, 2019

cherry pick to release-2.1 in PR #12744

@sre-bot
Copy link
Contributor

sre-bot commented Oct 16, 2019

cherry pick to release-3.0 in PR #12745

@sre-bot
Copy link
Contributor

sre-bot commented Oct 16, 2019

cherry pick to release-3.1 in PR #12761

XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

YEAR column is not compatible with MySQL
6 participants