Skip to content

Commit

Permalink
privileges: add missing items for show privileges | tidb-test=pr/20…
Browse files Browse the repository at this point in the history
…67 (#40600) (#40609)

close #40591
  • Loading branch information
ti-chi-bot committed Jan 18, 2023
1 parent e412d96 commit 0180126
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,16 @@ func TestShow(t *testing.T) {
tk.MustQuery("show create database test_show").Check(testkit.Rows("test_show CREATE DATABASE `test_show` /*!40100 DEFAULT CHARACTER SET utf8mb4 */"))
tk.MustQuery("show privileges").Check(testkit.Rows("Alter Tables To alter the table",
"Alter routine Functions,Procedures To alter or drop stored functions/procedures",
"Config Server Admin To use SHOW CONFIG and SET CONFIG statements",
"Create Databases,Tables,Indexes To create new databases and tables",
"Create routine Databases To use CREATE FUNCTION/PROCEDURE",
"Create role Server Admin To create new roles",
"Create temporary tables Databases To use CREATE TEMPORARY TABLE",
"Create view Tables To create new views",
"Create user Server Admin To create new users",
"Delete Tables To delete existing rows",
"Drop Databases,Tables To drop databases, tables, and views",
"Drop role Server Admin To drop roles",
"Event Server Admin To create, alter, drop and execute events",
"Execute Functions,Procedures To execute stored routines",
"File File access on server To read and write files on the server",
Expand Down
3 changes: 3 additions & 0 deletions executor/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -1604,13 +1604,16 @@ func (e *ShowExec) fetchShowGrants() error {
func (e *ShowExec) fetchShowPrivileges() error {
e.appendRow([]interface{}{"Alter", "Tables", "To alter the table"})
e.appendRow([]interface{}{"Alter routine", "Functions,Procedures", "To alter or drop stored functions/procedures"})
e.appendRow([]interface{}{"Config", "Server Admin", "To use SHOW CONFIG and SET CONFIG statements"})
e.appendRow([]interface{}{"Create", "Databases,Tables,Indexes", "To create new databases and tables"})
e.appendRow([]interface{}{"Create routine", "Databases", "To use CREATE FUNCTION/PROCEDURE"})
e.appendRow([]interface{}{"Create role", "Server Admin", "To create new roles"})
e.appendRow([]interface{}{"Create temporary tables", "Databases", "To use CREATE TEMPORARY TABLE"})
e.appendRow([]interface{}{"Create view", "Tables", "To create new views"})
e.appendRow([]interface{}{"Create user", "Server Admin", "To create new users"})
e.appendRow([]interface{}{"Delete", "Tables", "To delete existing rows"})
e.appendRow([]interface{}{"Drop", "Databases,Tables", "To drop databases, tables, and views"})
e.appendRow([]interface{}{"Drop role", "Server Admin", "To drop roles"})
e.appendRow([]interface{}{"Event", "Server Admin", "To create, alter, drop and execute events"})
e.appendRow([]interface{}{"Execute", "Functions,Procedures", "To execute stored routines"})
e.appendRow([]interface{}{"File", "File access on server", "To read and write files on the server"})
Expand Down

0 comments on commit 0180126

Please sign in to comment.