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

table: handling the boundary value of the timestamp type's default value #9578

Merged
merged 9 commits into from
Apr 1, 2019

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented Mar 6, 2019

What problem does this PR solve?

Fix #9513
Before this PR:

tidb> select now();
+---------------------+
| now()               |
+---------------------+
| 2019-02-28 21:09:20 |
+---------------------+
1 row in set (0.00 sec)

tidb> create table t(a int);
Query OK, 0 rows affected (0.01 sec)

tidb>  ALTER TABLE t ADD COLUMN ts timestamp DEFAULT '1970-01-01 08:00:01';
ERROR 1067 (42000): Invalid default value for 'ts'

After this PR, we can successfully execute ALTER TABLE t ADD COLUMN ts timestamp DEFAULT '1970-01-01 08:00:01';.

What is changed and how it works?

Using the correct time zone when checking the default value.

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch

@codecov-io
Copy link

codecov-io commented Mar 6, 2019

Codecov Report

Merging #9578 into master will decrease coverage by 0.0191%.
The diff coverage is 70.5882%.

@@               Coverage Diff                @@
##             master      #9578        +/-   ##
================================================
- Coverage   77.5768%   77.5577%   -0.0192%     
================================================
  Files           403        403                
  Lines         81844      81850         +6     
================================================
- Hits          63492      63481        -11     
- Misses        13656      13667        +11     
- Partials       4696       4702         +6

@zimulala
Copy link
Contributor Author

zimulala commented Mar 7, 2019

PTAL @crazycs520 @jackysp @tiancaiamao

1 similar comment
@zimulala
Copy link
Contributor Author

PTAL @crazycs520 @jackysp @tiancaiamao

table/column.go Outdated Show resolved Hide resolved
Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

REST LGTM

@zimulala
Copy link
Contributor Author

PTAL @crazycs520

Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

LGTM

@crazycs520 crazycs520 added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 14, 2019
Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 14, 2019
@zimulala
Copy link
Contributor Author

PTAL @winkyao

2 similar comments
@zimulala
Copy link
Contributor Author

zimulala commented Apr 1, 2019

PTAL @winkyao

@zimulala
Copy link
Contributor Author

zimulala commented Apr 1, 2019

PTAL @winkyao

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason
Copy link
Member

zz-jason commented Apr 1, 2019

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra 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.

Improper use of time zone when checking for default values ​in adding a column
8 participants