From 01801269bfed4d0826e8ac352016ff52130f3664 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Wed, 18 Jan 2023 18:57:49 +0800 Subject: [PATCH] privileges: add missing items for `show privileges` | tidb-test=pr/2067 (#40600) (#40609) close pingcap/tidb#40591 --- executor/executor_test.go | 3 +++ executor/show.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/executor/executor_test.go b/executor/executor_test.go index e79a66187a5cd..a2826d882bc76 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -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", diff --git a/executor/show.go b/executor/show.go index 69aa0b10b7e1b..8ee9d1a9332e5 100644 --- a/executor/show.go +++ b/executor/show.go @@ -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"})