mariadb/mysql-test/r/rpl_timezone.result
dlenev@brandersnatch.localdomain 09ba29e539 WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
  
WL#1266 "CONVERT_TZ() - basic time with time zone conversion 
function".
  
Fixed problems described in Bug #2336 (Different number of warnings 
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated 
at Field object level not in conversion functions).
  
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
2004-06-18 10:11:31 +04:00

77 lines
2.1 KiB
Text

stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (t timestamp);
create table t2 (t char(32));
select @@time_zone;
@@time_zone
Europe/Moscow
set time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
select * from t1;
t
2004-01-01 03:00:00
2004-06-11 13:39:02
delete from t1;
set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.000001 79 Query 1 79 use `test`; create table t1 (t timestamp)
master-bin.000001 143 Query 1 143 use `test`; create table t2 (t char(32))
master-bin.000001 206 Query 1 206 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
master-bin.000001 269 Query 1 269 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
master-bin.000001 364 Query 1 364 use `test`; delete from t1
master-bin.000001 413 Query 1 413 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
t
2003-12-31 22:00:00
2004-06-11 07:39:02
select * from t2;
t
2003-12-31 22:00:00
2004-06-11 07:39:02
delete from t2;
set timestamp=1000072000;
insert into t2 values (current_timestamp), (current_date), (current_time);
set timestamp=1000072000;
select current_timestamp, current_date, current_time;
current_timestamp current_date current_time
2001-09-10 01:46:40 2001-09-10 01:46:40
select * from t2;
t
2001-09-09 23:46:40
2001-09-09
23:46:40
delete from t2;
insert into t2 values (from_unixtime(1000000000)),
(unix_timestamp('2001-09-09 03:46:40'));
select * from t2;
t
2001-09-09 03:46:40
1000000000
select * from t2;
t
2001-09-09 03:46:40
1000000000
set global time_zone='MET';
ERROR HY000: Binary logging and replication forbid changing of the global server time zone
drop table t1, t2;