1drop tables if exists t1, t2; 2drop view if exists v1; 3delete from mysql.user where user like 'mysqltest\_%'; 4delete from mysql.db where user like 'mysqltest\_%'; 5delete from mysql.tables_priv where user like 'mysqltest\_%'; 6delete from mysql.columns_priv where user like 'mysqltest\_%'; 7flush privileges; 8create table t1 (a int, b datetime); 9create table t2 (c int, d datetime); 10grant all privileges on test.* to mysqltest_1@localhost; 11show grants for current_user(); 12Grants for mysqltest_1@localhost 13GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' 14GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'localhost' 15set time_zone= '+00:00'; 16set time_zone= 'Europe/Moscow'; 17select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC'); 18convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC') 192004-10-21 15:00:00 20select convert_tz(b, 'Europe/Moscow', 'UTC') from t1; 21convert_tz(b, 'Europe/Moscow', 'UTC') 22update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC') 23where t1.a = t2.c and t2.d = (select max(d) from t2); 24select * from mysql.time_zone_name; 25ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' 26select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name; 27ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' 28delete from mysql.db where user like 'mysqltest\_%'; 29flush privileges; 30grant all privileges on test.t1 to mysqltest_1@localhost; 31grant all privileges on test.t2 to mysqltest_1@localhost; 32show grants for current_user(); 33Grants for mysqltest_1@localhost 34GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' 35GRANT ALL PRIVILEGES ON `test`.`t2` TO 'mysqltest_1'@'localhost' 36GRANT ALL PRIVILEGES ON `test`.`t1` TO 'mysqltest_1'@'localhost' 37set time_zone= '+00:00'; 38set time_zone= 'Europe/Moscow'; 39select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC'); 40convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC') 41NULL 42Warnings: 43Warning 1292 Incorrect datetime value: '2004-11-31 12:00:00' 44select convert_tz(b, 'Europe/Moscow', 'UTC') from t1; 45convert_tz(b, 'Europe/Moscow', 'UTC') 46update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC') 47where t1.a = t2.c and t2.d = (select max(d) from t2); 48select * from mysql.time_zone_name; 49ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' 50select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name; 51ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' 52drop table t1, t2; 53create table t1 (a int, b datetime); 54create table t2 (a int, b varchar(40)); 55update t1 set b = '2005-01-01 10:00'; 56update t1 set b = convert_tz(b, 'UTC', 'UTC'); 57update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo'; 58update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo'; 59delete from mysql.user where user like 'mysqltest\_%'; 60delete from mysql.db where user like 'mysqltest\_%'; 61delete from mysql.tables_priv where user like 'mysqltest\_%'; 62flush privileges; 63drop table t1, t2; 64create table t1 (a int, b datetime); 65insert into t1 values (1, 20010101000000), (2, 20020101000000); 66grant all privileges on test.* to mysqltest_1@localhost; 67create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1; 68select * from v1; 69a lb 701 2001-01-01 03:00:00 712 2002-01-01 03:00:00 72select * from v1, mysql.time_zone; 73ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone' 74drop view v1; 75create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone; 76ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 'time_zone' 77drop table t1; 78drop user mysqltest_1@localhost; 79