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

privilege: alter table && rename privilege make same with MySQL #9872

Merged
merged 25 commits into from
Apr 4, 2019
Merged

privilege: alter table && rename privilege make same with MySQL #9872

merged 25 commits into from
Apr 4, 2019

Conversation

xiekeyi98
Copy link
Contributor

@xiekeyi98 xiekeyi98 commented Mar 24, 2019

What problem does this PR solve?

In MySQL:https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html#priv_alter

Enables use of the ALTER TABLE statement to change the structure of tables. ALTER TABLE also requires the CREATE and INSERT privileges. Renaming a table requires ALTER and DROP on the old table, CREATE, and INSERT on the new table.

Enables use of statements that drop (remove) existing databases, tables, and views. The DROP privilege is required to use the ALTER TABLE ... DROP PARTITION statement on a partitioned table. The DROP privilege is also required for TRUNCATE TABLE.

What is changed and how it works?

Add more privileges in alter table and rename to make the same with MySQL.

Check List

Tests

  • Unit test
  • Integration test

This change is Reviewable

Enables use of the ALTER TABLE statement to change the structure of tables. ALTER TABLE also requires the CREATE and INSERT privileges.
same with MySQL.
 Renaming a table requires ALTER and DROP on the old table, CREATE, and INSERT on the new table.
@xiekeyi98
Copy link
Contributor Author

truncate table isn't also the same with MySQL.
It will be fixed in #9870

@codecov
Copy link

codecov bot commented Mar 24, 2019

Codecov Report

Merging #9872 into master will decrease coverage by 0.001%.
The diff coverage is 100%.

@@               Coverage Diff                @@
##             master      #9872        +/-   ##
================================================
- Coverage   67.3512%   67.3501%   -0.0011%     
================================================
  Files           383        383                
  Lines         80444      80466        +22     
================================================
+ Hits          54180      54194        +14     
- Misses        21421      21422         +1     
- Partials       4843       4850         +7

@codecov
Copy link

codecov bot commented Mar 24, 2019

Codecov Report

Merging #9872 into master will decrease coverage by 0.0166%.
The diff coverage is 68.932%.

@@               Coverage Diff                @@
##             master      #9872        +/-   ##
================================================
- Coverage   77.7215%   77.7049%   -0.0167%     
================================================
  Files           403        403                
  Lines         81873      81942        +69     
================================================
+ Hits          63633      63673        +40     
- Misses        13547      13572        +25     
- Partials       4693       4697         +4

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.

Mostly LGTM

@xiekeyi98 xiekeyi98 marked this pull request as ready for review March 25, 2019 04:23
@@ -1640,6 +1640,39 @@ func (s *testPlanSuite) TestVisitInfo(c *C) {
{mysql.AllPrivMask, "test", "ttt", "", nil},
},
},
{
sql: "alter table t add column a int(4)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remember to update our document.

Copy link
Contributor Author

@xiekeyi98 xiekeyi98 Mar 27, 2019

Choose a reason for hiding this comment

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

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

winkyao
winkyao previously approved these changes Mar 31, 2019
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

@xiekeyi98
Copy link
Contributor Author

@zz-jason PTAL.
Any else should I change?

@xiekeyi98
Copy link
Contributor Author

/run-all-tests

Copy link
Member

@zz-jason zz-jason 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 zz-jason added the status/LGT2 Indicates that a PR has LGTM 2. label Apr 4, 2019
@xiekeyi98
Copy link
Contributor Author

/run-all-tests

1 similar comment
@xiekeyi98
Copy link
Contributor Author

/run-all-tests

@xiekeyi98
Copy link
Contributor Author

/run-all-tests

@xiekeyi98
Copy link
Contributor Author

/run-common-tests tidb-test=pr/776

@xiekeyi98
Copy link
Contributor Author

/run-all-tests

@xiekeyi98 xiekeyi98 merged commit 054517e into pingcap:master Apr 4, 2019
@xiekeyi98 xiekeyi98 deleted the TiDB-3397 branch April 4, 2019 07:35
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/privilege contribution This PR is from a community contributor. status/LGT2 Indicates that a PR has LGTM 2. type/compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants