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, expression: Disallow add stored generated columns through ALTER TABLE #10758

Merged
merged 3 commits into from
Jun 13, 2019

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented Jun 11, 2019

What problem does this PR solve?

A temporary solution for issue 9372.

According to current TiDB document, adding stored generated columns are not supported:

You cannot add the generated column in the storage type of STORED through ALTER TABLE.

So, an error should be returned for such statements.

What is changed and how it works?

  • A check in AddColumn()
  • Other redability improvements

Check the properties of the new column, if it is both Generated and Stored, return an errUnsupportedOnGeneratedColumn error.

Check List

Tests

  • Unit test

@codecov
Copy link

codecov bot commented Jun 11, 2019

Codecov Report

Merging #10758 into master will decrease coverage by 0.104%.
The diff coverage is 100%.

@@               Coverage Diff                @@
##             master     #10758        +/-   ##
================================================
- Coverage   80.3695%   80.2655%   -0.1041%     
================================================
  Files           416        416                
  Lines         88913      88419       -494     
================================================
- Hits          71459      70970       -489     
- Misses        12224      12241        +17     
+ Partials       5230       5208        -22

@tangenta tangenta requested a review from bb7133 June 11, 2019 03:47
ddl/generated_column.go Outdated Show resolved Hide resolved
ddl/generated_column.go Outdated Show resolved Hide resolved
@tangenta tangenta force-pushed the generated-col-limit branch 2 times, most recently from 8052216 to b612cc5 Compare June 12, 2019 15:37
ddl/db_test.go Outdated Show resolved Hide resolved
ddl/db_test.go Outdated Show resolved Hide resolved
ddl/db_test.go Outdated Show resolved Hide resolved
ddl/ddl.go Outdated Show resolved Hide resolved
ddl/generated_column.go Outdated Show resolved Hide resolved
ddl/generated_column.go Outdated Show resolved Hide resolved
@tangenta tangenta force-pushed the generated-col-limit branch 2 times, most recently from e332bf6 to c24bcb8 Compare June 13, 2019 02:13
ddl/generated_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

ddl/generated_column.go Outdated Show resolved Hide resolved
ddl/generated_column.go Outdated Show resolved Hide resolved
Copy link
Member

@bb7133 bb7133 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 component/DDL-need-LGT3 status/LGT2 Indicates that a PR has LGTM 2. labels Jun 13, 2019
ddl/generated_column.go Outdated Show resolved Hide resolved
ddl/db_test.go Outdated Show resolved Hide resolved
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

@winkyao
Copy link
Contributor

winkyao commented Jun 13, 2019

/run-all-tests

@tangenta
Copy link
Contributor Author

/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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants