1# The include statement below is a temp one for tests that are yet to
2#be ported to run with InnoDB,
3#but needs to be kept for tests that would need MyISAM in future.
4--source include/force_myisam_default.inc
5
6#
7# Test of handling time zone with leap seconds.
8#
9# This test should be run with TZ=:$MYSQL_TEST_DIR/std_data/Moscow_leap
10# This implies that this test should be run only on systems that interpret
11# characters after colon in TZ variable as path to zoneinfo file.
12#
13# Check that we have successfully set time zone with leap seconds.
14--require r/have_moscow_leap_timezone.require
15disable_query_log;
16select from_unixtime(1072904422);
17enable_query_log;
18
19# Initial clean-up
20--disable_warnings
21drop table if exists t1;
22--enable_warnings
23
24#
25# Let us check behavior of conversion from broken-down representation
26# to time_t representation, for normal, non-existent and ambigious dates
27# (This check is similar to the one in timezone2.test in 4.1)
28#
29create table t1 (i int, c varchar(20));
30# Normal value without DST
31insert into t1 values
32  (unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
33# Values around and in spring time-gap
34insert into t1 values
35  (unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
36  (unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
37  (unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
38# Normal value with DST
39insert into t1 values
40  (unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
41# Ambiguos values (also check for determenism)
42insert into t1 values
43  (unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
44  (unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
45  (unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
46  (unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
47  (unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
48# Test of leap
49insert into t1 values
50  (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
51  (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
52
53insert into t1 values
54  (unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
55  (unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
56
57select i, from_unixtime(i), c from t1;
58drop table t1;
59
60#
61# Test for bug #6387 "Queried timestamp values do not match the
62# inserted". my_gmt_sec() function was not working properly if we
63# had time zone with leap seconds
64#
65create table t1 (ts timestamp);
66insert into t1 values (19730101235900), (20040101235900);
67select * from t1;
68drop table t1;
69
70#
71# Test Bug #39920: MySQL cannot deal with Leap Second expression in string
72# literal
73#
74
75# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00
76SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
77
78# End of 4.1 tests
79