~drizzle-trunk/drizzle/development

1 by brian
clean slate
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 r/have_moscow_leap_timezone.require
10
disable_query_log;
11
select from_unixtime(1072904422);
12
enable_query_log;
13
14
# Initial clean-up
15
--disable_warnings
16
drop 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
#
24
create table t1 (i int, c varchar(20));
25
# Normal value without DST
26
insert 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
29
insert 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
34
insert 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)
37
insert 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
44
insert 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
48
select i, from_unixtime(i), c from t1;
49
drop table t1;
50
51
#
52
# Test for bug #6387 "Queried timestamp values do not match the 
53
# inserted". my_gmt_sec() function was not working properly if we
54
# had time zone with leap seconds 
55
#
56
create table t1 (ts timestamp);
57
insert into t1 values (19730101235900), (20040101235900);
58
select * from t1;
59
drop table t1;
60
61
# End of 4.1 tests