summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-06-17 08:56:04 -0700
committerunknown <jimw@mysql.com>2005-06-17 08:56:04 -0700
commit9a27672396b660c8c89c30bafcfbb00849a06723 (patch)
tree8e9b1c55491632113d80ea77fb3178e78cbd4a27 /mysql-test
parentf8f95d1c91bc1c39d2c9241f0781a7e7a45e8077 (diff)
downloadmariadb-git-9a27672396b660c8c89c30bafcfbb00849a06723.tar.gz
Fix spurious permissions problem when CONVERT_TZ() is used
in a multi-table update query. (Bug #9979) mysql-test/r/timezone_grant.result: Add new results mysql-test/t/timezone_grant.test: Add new test sql/sql_parse.cc: Make sure to check lex->time_zone_tables_used to determine if we are using additional tables.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/timezone_grant.result7
-rw-r--r--mysql-test/t/timezone_grant.test12
2 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/timezone_grant.result b/mysql-test/r/timezone_grant.result
index 685f8007ac7..471cacde300 100644
--- a/mysql-test/r/timezone_grant.result
+++ b/mysql-test/r/timezone_grant.result
@@ -45,6 +45,13 @@ select * from mysql.time_zone_name;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
+drop table t1, t2;
+create table t1 (a int, b datetime);
+create table t2 (a int, b varchar(40));
+update t1 set b = '2005-01-01 10:00';
+update t1 set b = convert_tz(b, 'UTC', 'UTC');
+update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo';
+update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo';
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\_%';
diff --git a/mysql-test/t/timezone_grant.test b/mysql-test/t/timezone_grant.test
index 501315668f5..8627866a0bf 100644
--- a/mysql-test/t/timezone_grant.test
+++ b/mysql-test/t/timezone_grant.test
@@ -61,6 +61,18 @@ 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;
+#
+# Bug #9979: Use of CONVERT_TZ in multiple-table UPDATE causes bogus
+# privilege error
+#
+drop table t1, t2;
+create table t1 (a int, b datetime);
+create table t2 (a int, b varchar(40));
+update t1 set b = '2005-01-01 10:00';
+update t1 set b = convert_tz(b, 'UTC', 'UTC');
+update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo';
+update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo';
+
# Clean-up
connection default;
delete from mysql.user where user like 'mysqltest\_%';