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, executor: support SET DEFAULT ROLE #9949

Merged
merged 14 commits into from
Apr 17, 2019

Conversation

imtbkcat
Copy link

What problem does this PR solve?

Support SET DEFAULT ROLE gramma.
See https://dev.mysql.com/doc/refman/8.0/en/set-default-role.html for detail

What is changed and how it works?

When SET DEFAULT ROLE for some users, we clear their data in mysql.default_roles and insert new default role information into mysql.default_roles.

Things need to be pay attention is handling error when insert transaction failed.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

  • Increased code complexity

@codecov
Copy link

codecov bot commented Apr 4, 2019

Codecov Report

Merging #9949 into master will decrease coverage by 0.075%.
The diff coverage is 57.1428%.

@@               Coverage Diff                @@
##             master      #9949        +/-   ##
================================================
- Coverage   77.9619%   77.8868%   -0.0751%     
================================================
  Files           405        405                
  Lines         82244      82381       +137     
================================================
+ Hits          64119      64164        +45     
- Misses        13392      13456        +64     
- Partials       4733       4761        +28

@imtbkcat
Copy link
Author

imtbkcat commented Apr 4, 2019

/run-all-tests

@imtbkcat
Copy link
Author

imtbkcat commented Apr 4, 2019

parser pr: pingcap/parser#266

session/session.go Outdated Show resolved Hide resolved
@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 11, 2019
@tiancaiamao
Copy link
Contributor

PTAL @jackysp @lysu

}
e.done = true
return err
}

func (e *SimpleExec) setDefaultRoleNone(s *ast.SetDefaultRoleStmt) error {
if _, err := e.ctx.(sqlexec.SQLExecutor).Execute(context.Background(), "begin"); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

could we avoid repeatedly using the interface assert?

Copy link
Author

Choose a reason for hiding this comment

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

PTAL @jackysp

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp jackysp merged commit abeddab into pingcap:master Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/privilege sig/execution SIG execution status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants