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

util/types: fix parsing datatime 00-00-00 #3536

Merged
merged 2 commits into from
Jun 23, 2017

Conversation

tiancaiamao
Copy link
Contributor

00-00-00 should not be adjust year to 2000-00-00

It should be:

mysql> create table t2 (a int, t datetime);
Query OK, 0 rows affected (0.19 sec)

mysql> insert into t2 values (1, "00-00-00");
Query OK, 1 row affected (0.00 sec)

mysql> select * from t2;
+------+---------------------+
| a    | t                   |
+------+---------------------+
|    1 | 0000-00-00 00:00:00 |
+------+---------------------+
1 row in set (0.00 sec)

But we got:

mysql> select * from t2;
+------+---------------------+
| a    | t                   |
+------+---------------------+
|    1 | 2000-00-00 00:00:00 |
+------+---------------------+
1 row in set (0.01 sec)

00-00-00 should not be adjust year to 2000-00-00
@hanfei1991
Copy link
Member

LGTM

@hanfei1991 hanfei1991 added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 23, 2017
@tiancaiamao
Copy link
Contributor Author

PTAL @XuHuaiyu @zimulala @shenli

@@ -48,6 +48,8 @@ func (s *testTimeSuite) TestDateTime(c *C) {
{"20121231113045", "2012-12-31 11:30:45"},
{"121231113045", "2012-12-31 11:30:45"},
{"2012-02-29", "2012-02-29 00:00:00"},
{"00-00-00", "0000-00-00 00:00:00"},
{"00-00-00 00:00:00.123", "2000-00-00 00:00:00"},
Copy link
Contributor

Choose a reason for hiding this comment

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

why not 2000-00-00 00:00:00.123? @tiancaiamao

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because ParseDataTime use DefaultFsp which is 0, fsp part is ignored. @XuHuaiyu

@zimulala
Copy link
Contributor

LGTM

zimulala
zimulala previously approved these changes Jun 23, 2017
@XuHuaiyu XuHuaiyu dismissed zimulala’s stale review June 23, 2017 09:30

wait for address comment

@tiancaiamao tiancaiamao merged commit dcf0da9 into master Jun 23, 2017
@tiancaiamao tiancaiamao deleted the tiancaiamao/parse-datetime-00 branch June 23, 2017 10:20
tiancaiamao added a commit that referenced this pull request Jul 13, 2017
00-00-00 should not be adjust year to 2000-00-00
tiancaiamao added a commit that referenced this pull request Jul 13, 2017
* expression, executor: fix hex(binary) (#3567)

* expression, executor: fix unhex(binary) error (#3569)

* expression: builtin now() should consider timestamp variable (#3590)

* tidb/privilege/privileges: make show databases available with any global privilege (#3666)

* privilege/privileges: skip privilege check for information_schema database (#3675)

* conn: fix database info leaking problem (#3699)

* server: escape database name "use `xxx`" in OpenCtx (#3713)

* executor: fix explicitly insert null value into timestamp column (#3646)

* util/types: fix parsing datatime 00-00-00 (#3536)

* tidb-server: fix incorrect error message when auth failed (#3696)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants