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