summaryrefslogtreecommitdiff
path: root/mysql-test/main/grant.test
diff options
context:
space:
mode:
authorAnel Husakovic <anel@mariadb.org>2019-07-04 22:38:47 -0700
committerAnel Husakovic <anel@mariadb.org>2019-07-24 23:19:43 -0700
commit55d8ff0de8168d3b7d465644dc93dca01f53f4f6 (patch)
treeafe09128f77ad598a41647caabbc0652e011ac08 /mysql-test/main/grant.test
parent0d99ccea1e5d7dab3ece44071c10f5b37f634201 (diff)
downloadmariadb-git-55d8ff0de8168d3b7d465644dc93dca01f53f4f6.tar.gz
MDEV-19948 `SHOW GRANTS FOR user` return privileges individually
Diffstat (limited to 'mysql-test/main/grant.test')
-rw-r--r--mysql-test/main/grant.test37
1 files changed, 37 insertions, 0 deletions
diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test
index f54c4bd981d..2b8d7337ceb 100644
--- a/mysql-test/main/grant.test
+++ b/mysql-test/main/grant.test
@@ -2258,3 +2258,40 @@ DROP USER dummy@localhost;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-19948 'show grants' return privileges individually
+--echo #
+
+# Let's cheat server that we are using `10.2` user table
+# which doesn't have `Delete_history_priv` column
+
+SET @had_user_delete_history_priv := 0;
+SELECT @had_user_delete_history_priv :=1 FROM mysql.user WHERE Delete_history_priv LIKE '%';
+
+ALTER TABLE mysql.user DROP COLUMN Delete_history_priv;
+FLUSH PRIVILEGES;
+CREATE USER ten2;
+GRANT ALL ON *.* TO ten2;
+
+# Without any patching, this should show a lot of privileges,
+# but without delete history. With patch it is showing `all privileges`
+SHOW GRANTS FOR ten2;
+FLUSH PRIVILEGES;
+
+# Now should show `all privileges` with/without patch
+SHOW GRANTS FOR ten2;
+DROP USER ten2;
+
+# Restore original table (similar to `mysql_upgrade`)
+ALTER TABLE mysql.user ADD Delete_history_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Create_tablespace_priv;
+UPDATE mysql.user SET Delete_history_priv = Super_priv WHERE @had_user_delete_history_priv = 1;
+FLUSH PRIVILEGES;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #