summaryrefslogtreecommitdiff
path: root/mysql-test/t/timezone2.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/timezone2.test')
-rw-r--r--mysql-test/t/timezone2.test42
1 files changed, 37 insertions, 5 deletions
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
index 75e5d4bfe81..4f70539ca8d 100644
--- a/mysql-test/t/timezone2.test
+++ b/mysql-test/t/timezone2.test
@@ -69,7 +69,7 @@ set time_zone='UTC';
select * from t1;
-delete from t1;
+truncate table t1;
# Simple check for 'Europe/Moscow' time zone just for showing that it works
set time_zone='Europe/Moscow';
@@ -79,7 +79,7 @@ insert into t1 (i, ts) values
(unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
(unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
select * from t1;
-delete from t1;
+truncate table t1;
#
@@ -94,7 +94,7 @@ insert into t1 (i, ts) values
(unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
(unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
select * from t1;
-delete from t1;
+truncate table t1;
# Let us test leap jump
insert into t1 (i, ts) values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
@@ -115,14 +115,14 @@ insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
('2038-01-19 03:14:07'),('2038-01-19 03:14:08');
select * from t1;
-delete from t1;
+truncate table t1;
# MET time zone has range shifted by one hour
set time_zone='MET';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
('2038-01-19 04:14:07'),('2038-01-19 04:14:08');
select * from t1;
-delete from t1;
+truncate table t1;
# same for +01:30 time zone
set time_zone='+01:30';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
@@ -228,6 +228,8 @@ drop table t1;
# Test for bug #11081 "Using a CONVERT_TZ function in a stored function
# or trigger fails".
#
+SET GLOBAL log_bin_trust_function_creators = 1;
+
create table t1 (ldt datetime, udt datetime);
create function f1(i datetime) returns datetime
return convert_tz(i, 'UTC', 'Europe/Moscow');
@@ -241,4 +243,34 @@ select ldt, f1(udt) as ldt2 from t1;
drop table t1;
drop function f1;
+SET GLOBAL log_bin_trust_function_creators = 0;
+
# End of 5.0 tests
+
+
+#
+# BUG#9953: CONVERT_TZ requires mysql.time_zone_name to be locked
+# BUG#19339: CONVERT_TZ(): overly aggressive in locking time_zone_name
+# table
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (t TIMESTAMP);
+INSERT INTO t1 VALUES (NULL), (NULL);
+
+LOCK TABLES t1 WRITE;
+
+# The following two queries should not return error that time zone
+# tables aren't locked. We use IS NULL below to supress timestamp
+# result.
+SELECT CONVERT_TZ(NOW(), 'UTC', 'Europe/Moscow') IS NULL;
+UPDATE t1 SET t = CONVERT_TZ(t, 'UTC', 'Europe/Moscow');
+
+UNLOCK TABLES;
+
+DROP TABLE t1;
+
+
+--echo End of 5.1 tests