summaryrefslogtreecommitdiff
path: root/mysql-test/t/timezone_grant.test
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-03-29 17:17:46 -0800
committerunknown <jimw@mysql.com>2005-03-29 17:17:46 -0800
commit57221d3d086bf8553d618ff7700bb3a7db0edb8f (patch)
tree5b4f57966d1a1dbc9789a2b148b4ad4a01328ceb /mysql-test/t/timezone_grant.test
parentbaf121de4f11c478c920c4bc21fef9d1be675a6e (diff)
downloadmariadb-git-57221d3d086bf8553d618ff7700bb3a7db0edb8f.tar.gz
Eliminate most of the remaining hardcoded list of tests to skip
by adding check for embedded server within tests and splitting some tests into multiple test files. mysql-test/mysql-test-run.sh: Remove most of hardcoded list of tests to skip mysql-test/r/ps_1general.result: Update results mysql-test/r/timezone2.result: Update results mysql-test/r/user_var.result: Update results mysql-test/r/variables.result: Update results mysql-test/t/mix_innodb_myisam_binlog.test: Disable test with embedded server mysql-test/t/mysql_protocols.test: Disable test with embedded server mysql-test/t/mysqlbinlog.test: Disable test with embedded server mysql-test/t/mysqlbinlog2.test: Disable test with embedded server mysql-test/t/mysqldump.test: Disable test with embedded server mysql-test/t/packet.test: Disable test with embedded server mysql-test/t/ps_1general.test: Move parts of test to new ps_grant mysql-test/t/rename.test: Disable test with embedded server mysql-test/t/show_check.test: Disable test with embedded server mysql-test/t/system_mysql_db_fix.test: Disable test with embedded server mysql-test/t/timezone2.test: Move part of test to timezone_grant mysql-test/t/user_var.test: Move part of test to new user_var-binlog mysql-test/t/variables.test: Move part of test to rpl_variables
Diffstat (limited to 'mysql-test/t/timezone_grant.test')
-rw-r--r--mysql-test/t/timezone_grant.test71
1 files changed, 71 insertions, 0 deletions
diff --git a/mysql-test/t/timezone_grant.test b/mysql-test/t/timezone_grant.test
new file mode 100644
index 00000000000..501315668f5
--- /dev/null
+++ b/mysql-test/t/timezone_grant.test
@@ -0,0 +1,71 @@
+# Embedded server testing does not support grants
+-- source include/not_embedded.inc
+
+#
+# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
+# tables". We should allow implicit access to time zone description tables
+# even for unprivileged users.
+#
+
+# Let us prepare playground
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+create table t1 (a int, b datetime);
+create table t2 (c int, d datetime);
+
+grant all privileges on test.* to mysqltest_1@localhost;
+connect (tzuser, localhost, mysqltest_1,,);
+connection tzuser;
+show grants for current_user();
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
+select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
+# Let us also check whenever multi-update works ok
+update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
+ where t1.a = t2.c and t2.d = (select max(d) from t2);
+# But still these two statements should not work:
+--error 1044
+select * from mysql.time_zone_name;
+--error 1044
+select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
+
+#
+# Test for bug #6765 "Implicit access to time zone description tables
+# requires privileges for them if some table or column level grants
+# present"
+#
+connection default;
+# Let use some table-level grants instead of db-level
+# to make life more interesting
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
+grant all privileges on test.t1 to mysqltest_1@localhost;
+grant all privileges on test.t2 to mysqltest_1@localhost;
+# The test itself is almost the same as previous one
+connect (tzuser2, localhost, mysqltest_1,,);
+connection tzuser2;
+show grants for current_user();
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
+select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
+update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
+ where t1.a = t2.c and t2.d = (select max(d) from t2);
+# Again these two statements should not work (but with different errors):
+--error 1142
+select * from mysql.time_zone_name;
+--error 1142
+select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
+
+# Clean-up
+connection default;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+flush privileges;
+drop table t1, t2;
+