~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/timezone3.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
insert 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
 
 
52
select i, from_unixtime(i), c from t1;
 
53
drop 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
#
 
60
create table t1 (ts timestamp);
 
61
insert into t1 values (19730101235900), (20040101235900);
 
62
select * from t1;
 
63
drop 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
 
71
SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
 
72
 
 
73
# End of 4.1 tests