summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <gluh@gluh.mysql.r18.ru>2004-04-05 17:55:26 +0500
committerunknown <gluh@gluh.mysql.r18.ru>2004-04-05 17:55:26 +0500
commit8c06c8c01025668cdfa6ae66f25060b012ef2347 (patch)
treee0bb9eeebf8b928e1196274803e37d4faa9612e7 /mysql-test
parentf8b790d0271213ebc881ccdcd22e1a6ecdd2b20f (diff)
downloadmariadb-git-8c06c8c01025668cdfa6ae66f25060b012ef2347.tar.gz
WL1368: SHOW GRANTS FOR CURRENT USER
'SHOW GRANTS' syntax is added 'SHOW GRANTS FOR CURRENT_USER' syntax is added 'SHOW GRANTS FOR CURRENT_USER()' syntax is added CURRENT_USER without parens in expressions(SELECT CURRENT_USER;) mysql-test/r/grant2.result: WL1368: SHOW GRANTS FOR CURRENT USER mysql-test/r/grant_cache.result: WL1368: SHOW GRANTS FOR CURRENT USER mysql-test/t/grant2.test: WL1368: SHOW GRANTS FOR CURRENT USER mysql-test/t/grant_cache.test: WL1368: SHOW GRANTS FOR CURRENT USER sql/lex.h: WL1368: SHOW GRANTS FOR CURRENT USER sql/sql_yacc.yy: WL1368: SHOW GRANTS FOR CURRENT USER
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/grant2.result3
-rw-r--r--mysql-test/r/grant_cache.result17
-rw-r--r--mysql-test/t/grant2.test1
-rw-r--r--mysql-test/t/grant_cache.test8
4 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 0b127188586..d0765e2721f 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -5,6 +5,9 @@ grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
select current_user();
current_user()
mysqltest_1@localhost
+select current_user;
+current_user
+mysqltest_1@localhost
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'my_%'
diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result
index fc4073d23b1..48068c0f68d 100644
--- a/mysql-test/r/grant_cache.result
+++ b/mysql-test/r/grant_cache.result
@@ -2,6 +2,12 @@ drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
drop database if exists mysqltest;
reset query cache;
flush status;
+show grants for current_user;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+show grants;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
create database if not exists mysqltest;
create table mysqltest.t1 (a int,b int,c int);
create table mysqltest.t2 (a int,b int,c int);
@@ -41,6 +47,10 @@ grant SELECT on mysqltest.* to mysqltest_1@localhost;
grant SELECT on mysqltest.t1 to mysqltest_2@localhost;
grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
+show grants for current_user();
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
@@ -101,6 +111,9 @@ Qcache_hits 3
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 1
+show grants for current_user();
+Grants for @localhost
+GRANT USAGE ON *.* TO ''@'localhost'
select "user2";
user2
user2
@@ -158,6 +171,10 @@ Qcache_not_cached 7
select "user4";
user4
user4
+show grants;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select a from t1;
ERROR 3D000: No Database Selected
select * from mysqltest.t1,test.t1;
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 148c4d3da21..1fc1ed78385 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -15,6 +15,7 @@ grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
connect (user1,localhost,mysqltest_1,,);
connection user1;
select current_user();
+select current_user;
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
--error 1044
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test
index 5ebf621ff40..7806253124e 100644
--- a/mysql-test/t/grant_cache.test
+++ b/mysql-test/t/grant_cache.test
@@ -12,6 +12,8 @@ reset query cache;
flush status;
connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
connection root;
+show grants for current_user;
+show grants;
--disable_warnings
create database if not exists mysqltest;
--enable_warnings
@@ -43,6 +45,7 @@ grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
# The following queries should be fetched from cache
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
connection user1;
+show grants for current_user();
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
show status like "Qcache_not_cached";
@@ -64,6 +67,10 @@ show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
show status like "Qcache_not_cached";
+connect (unkuser,localhost,,,,$MASTER_MYPORT,master.sock);
+connection unkuser;
+show grants for current_user();
+
# The following queries should be fetched from cache
connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,master.sock);
connection user2;
@@ -104,6 +111,7 @@ show status like "Qcache_not_cached";
connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock);
connection user4;
select "user4";
+show grants;
--error 1046
select a from t1;
# The following query is not cached before (different database)