-
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
expression,ddl: fix fraction part handle of current_timestamp #7355
expression,ddl: fix fraction part handle of current_timestamp #7355
Conversation
/run-all-tests |
LGTM |
@@ -121,10 +121,10 @@ CREATE TABLE `te` ( | |||
`device_identy` varchar(36) NOT NULL, | |||
`uuid` varchar(32) NOT NULL, | |||
`status_flag` tinyint(4) NOT NULL, | |||
`client_create_time` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | |||
`client_create_time` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), |
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.
Can we not adding (3)
to CURRENT_TIMESTAMP
?
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.
check fsp in create table is rollbacked in this PR, 83b4e233457a98dd5f52d633a44445d63b351e08.
@@ -1760,7 +1760,7 @@ func (s *testDBSuite) TestTableDDLWithTimeType(c *C) { | |||
s.testErrorCode(c, "alter table t change column a aa time(7)", tmysql.ErrTooBigPrecision) | |||
s.testErrorCode(c, "alter table t change column a aa datetime(7)", tmysql.ErrTooBigPrecision) | |||
s.testErrorCode(c, "alter table t change column a aa timestamp(7)", tmysql.ErrTooBigPrecision) | |||
s.mustExec(c, "alter table t change column a aa timestamp(0)") | |||
s.mustExec(c, "alter table t change column a aa datetime(0)") |
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.
Why this is changed to datetime
?
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.
because previous test is wrong and should be failure with
ERROR 1105 (HY000): unsupported modify column type 7 not match origin 12
- -
and it's strange mustExec in ddl_test seems ignore the err and doesn't fail the case.
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.
The test doesn't init the testKit, but reuse the one in the suite, so the test case never fail.
LGTM |
/run-all-tests |
@lysu plz resolve conflicts so we can merge this PR 😄 |
@zz-jason done~ |
What problem does this PR solve?
In this PR, fix the bug that
=
retrieves the record that inserted bycurrent_timestamp
.This bug is caused by
current_timestamp
doesn't take care of thefsp
argument.user often use default
fsp
oftimestamp
and it is0
, but current_timestamp generate and insert data with fsp part into storage. so when user selection table with no fsp value(they know nothing about fsp also not care about that..) and got the empty response.for old data after this PR still cannot retrieve by
=
, but new data will work.Still exists question
expect that when creating a table with current_timestamp we should confirm
column's fsp == funcation's fsp
, but solve this will break compatible, so 83b4e233457a98dd5f52d633a44445d63b351e08 rollbacked.also see: https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html
What is changed and how it works?
GetTimeValue
follow fsp argument.Check List
Code changes
Side effects
Related changes
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)