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

ddl: disallow modifying the generated expression of stored or indexed column #10932

Merged
merged 12 commits into from Jul 3, 2019

Conversation

Projects
None yet
5 participants
@tangenta
Copy link
Contributor

commented Jun 25, 2019

What problem does this PR solve?

A temporary solution for issue #10924 and issue #10937.

And fix issue #10973.

What is changed and how it works?

  • move the auto_increment check from ModifyColumn() into checkModifyGeneratedColumn(), which is shared by both modify column and change column, fixing issue #10973.
  • refactor a tiny code block
  • add a check for indexed or stored column

Now it forbids three modify or change operations:

  • changing the expression of the generated stored column is not allowed.
  • changing the expression of the generated column with indexes is not allowed.
  • changing a non-generated column to a generated stored column is not allowed.

Check List

Tests

  • Unit test
  • Integration test

Side effects

Related changes

  • Need to update the documentation
@tangenta

This comment has been minimized.

Copy link
Contributor Author

commented Jun 25, 2019

/run-all-tests

@codecov

This comment has been minimized.

Copy link

commented Jun 25, 2019

Codecov Report

Merging #10932 into master will decrease coverage by 0.0092%.
The diff coverage is 100%.

@@               Coverage Diff                @@
##             master     #10932        +/-   ##
================================================
- Coverage   81.1376%   81.1283%   -0.0093%     
================================================
  Files           419        419                
  Lines         89432      89155       -277     
================================================
- Hits          72563      72330       -233     
+ Misses        11627      11577        -50     
- Partials       5242       5248         +6
@codecov

This comment has been minimized.

Copy link

commented Jun 25, 2019

Codecov Report

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

@@             Coverage Diff             @@
##             master     #10932   +/-   ##
===========================================
  Coverage   81.0483%   81.0483%           
===========================================
  Files           419        419           
  Lines         89533      89533           
===========================================
  Hits          72565      72565           
  Misses        11741      11741           
  Partials       5227       5227
@tangenta

This comment has been minimized.

Copy link
Contributor Author

commented Jun 25, 2019

/run-all-tests

Show resolved Hide resolved ddl/ddl_api.go Outdated
Show resolved Hide resolved ddl/db_test.go Outdated
Show resolved Hide resolved ddl/db_test.go Outdated

@tangenta tangenta requested review from crazycs520 and Deardrops Jun 25, 2019

@tangenta tangenta changed the title ddl: disallow modifying virtual columns with index ddl: disallow modifying generated columns with index Jun 25, 2019

Show resolved Hide resolved ddl/ddl_api.go Outdated
@tangenta

This comment has been minimized.

Copy link
Contributor Author

commented Jun 25, 2019

/run-all-tests

Show resolved Hide resolved ddl/db_test.go Outdated
Show resolved Hide resolved ddl/ddl_api.go Outdated
Show resolved Hide resolved ddl/db_test.go

@tangenta tangenta added the status/WIP label Jun 28, 2019

tangenta added some commits Jun 28, 2019

@tangenta tangenta removed the status/WIP label Jun 28, 2019

@tangenta tangenta requested review from winkyao and crazycs520 Jun 28, 2019

@tangenta tangenta changed the title ddl: disallow modifying generated columns with index ddl: disallow modifying generated columns with `stored` or index Jun 28, 2019

Show resolved Hide resolved ddl/generated_column.go
Show resolved Hide resolved ddl/generated_column.go
@winkyao
Copy link
Member

left a comment

LGTM

@crazycs520
Copy link
Contributor

left a comment

LGTM

@crazycs520

This comment has been minimized.

Copy link
Contributor

commented Jul 2, 2019

/run-all-tests

@tangenta tangenta added the status/DNM label Jul 2, 2019

@tangenta tangenta changed the title ddl: disallow modifying generated columns with `stored` or index ddl: disallow modifying the generated expression of stored or indexed column Jul 2, 2019

@tangenta tangenta removed the status/DNM label Jul 2, 2019

tangenta and others added some commits Jul 2, 2019

@bb7133

bb7133 approved these changes Jul 3, 2019

Copy link
Contributor

left a comment

LGTM

@tangenta tangenta merged commit 755875a into pingcap:master Jul 3, 2019

6 checks passed

ci/circleci Your tests passed on CircleCI!
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/build_check_race Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev_2 Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

tangenta added a commit to tangenta/tidb that referenced this pull request Jul 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.