summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2004-04-07 17:23:04 +0500
committerunknown <vva@eagle.mysql.r18.ru>2004-04-07 17:23:04 +0500
commit91fb27a3ca13beffcfec0fef93f12c580bad260f (patch)
tree8845903549a71ec8bb71efb64fb1fd4d0a63201d /mysql-test
parente9447881eb13378b06f0939091ab4e258a83ad51 (diff)
parent6c3106456def1ba07d0aa2610be615222095df7f (diff)
downloadmariadb-git-91fb27a3ca13beffcfec0fef93f12c580bad260f.tar.gz
Merge eagle.mysql.r18.ru:/home/vva/work/mysql.orig/clear/mysql-4.1
into eagle.mysql.r18.ru:/home/vva/work/BUG_3342/mysql-4.1 sql/sql_parse.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/show_check.result38
-rw-r--r--mysql-test/t/show_check.test48
2 files changed, 86 insertions, 0 deletions
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 5a5eb025353..b54d4b5a342 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -362,3 +362,41 @@ t1 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
drop table t1, t2, t3;
+create database test_$1;
+show create database test_$1;
+Database Create Database
+test_$1 CREATE DATABASE `test_$1` /*!40100 DEFAULT CHARACTER SET latin1 */
+create table test_$1.t1(a int);
+insert into test_$1.t1 values(1);
+grant select on `test_$1`.* to mysqltest_1@localhost;
+grant usage on `test_$1`.* to mysqltest_2@localhost;
+grant drop on `test_$1`.* to mysqltest_3@localhost;
+select * from t1;
+a
+1
+show create database test_$1;
+Database Create Database
+test_$1 CREATE DATABASE `test_$1` /*!40100 DEFAULT CHARACTER SET latin1 */
+drop table t1;
+ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'test_$1'
+drop database test_$1;
+ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'test_$1'
+select * from test_$1.t1;
+ERROR 42000: Access denied for user: 'mysqltest_2'@'localhost' to database 'test_$1'
+show create database test_$1;
+ERROR 42000: Access denied for user: 'mysqltest_2'@'localhost' to database 'test_$1'
+drop table test_$1.t1;
+ERROR 42000: Access denied for user: 'mysqltest_2'@'localhost' to database 'test_$1'
+drop database test_$1;
+ERROR 42000: Access denied for user: 'mysqltest_2'@'localhost' to database 'test_$1'
+select * from test_$1.t1;
+ERROR 42000: Access denied for user: 'mysqltest_3'@'localhost' to database 'test_$1'
+show create database test_$1;
+ERROR 42000: Access denied for user: 'mysqltest_3'@'localhost' to database 'test_$1'
+drop table test_$1.t1;
+drop database test_$1;
+delete from mysql.user
+where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+delete from mysql.db
+where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+flush privileges;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 638626a7456..b0307af19bb 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -256,3 +256,51 @@ delete from t3 where a=5;
show table status;
drop table t1, t2, t3;
+
+#
+# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege
+#
+
+create database test_$1;
+show create database test_$1;
+create table test_$1.t1(a int);
+insert into test_$1.t1 values(1);
+grant select on `test_$1`.* to mysqltest_1@localhost;
+grant usage on `test_$1`.* to mysqltest_2@localhost;
+grant drop on `test_$1`.* to mysqltest_3@localhost;
+
+connect (con1,localhost,mysqltest_1,,test_$1);
+connection con1;
+select * from t1;
+show create database test_$1;
+--error 1044
+drop table t1;
+--error 1044
+drop database test_$1;
+
+connect (con2,localhost,mysqltest_2,,test);
+connection con2;
+--error 1044
+select * from test_$1.t1;
+--error 1044
+show create database test_$1;
+--error 1044
+drop table test_$1.t1;
+--error 1044
+drop database test_$1;
+
+connect (con3,localhost,mysqltest_3,,test);
+connection con3;
+--error 1044
+select * from test_$1.t1;
+--error 1044
+show create database test_$1;
+drop table test_$1.t1;
+drop database test_$1;
+
+connection default;
+delete from mysql.user
+where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+delete from mysql.db
+where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+flush privileges;