Edit Additional info per comments
What result do you get if you drop the p.k?
set TIME_ZONE='+0:00';
insert into a values(1, '2018-11-04 06:01:00.000');
insert into a values(1, '2018-11-04 07:01:00.000');
select * from a ;
select 'Set time_zone=US/Central' as msg;
set TIME_ZONE='US/Central';
+------------------+
| COUNT_WITH_INDEX |
+------------------+
| 1 |
+------------------+
1 row in set (0.00 sec)
drop index `primary` on a;
select count(*) as COUNT_DROPPED_PK
from a
where id = 1 and begin_time='2018-11-04 01:01:00.000';
+------------------+
| COUNT_DROPPED_PK |
+------------------+
| 2 |
+------------------+
1 row in set (0.00 sec)
set TIME_ZONE='+0:00';
select * from a;
+----+-------------------------+
| id | begin_time |
+----+-------------------------+
| 1 | 2018-11-04 06:01:00.000 |
| 1 | 2018-11-04 06:01:00.000 |
+----+-------------------------+
Notice If I change the TZ to US/Central, drop the PK, then set the TZ back to '+0:00', I can see that the data is screwed up. Both records are 06:01
time, when one was inserted 07:01
. That behavior is not logical to me since the timestamps should always be UTC in the backend.
- Show the output of set TIME_ZONE='US/Eastern'; select * from a; 2) What if set TIME_ZONE='-4:00';?
set TIME_ZONE='US/Eastern';
select * from a;
+----+-------------------------+
| id | begin_time |
+----+-------------------------+
| 1 | 2018-11-04 01:01:00.000 |
| 1 | 2018-11-04 02:01:00.000 |
+----+-------------------------+
set TIME_ZONE='-4:00';
select * from a;
+----+-------------------------+
| id | begin_time |
+----+-------------------------+
| 1 | 2018-11-04 02:01:00.000 |
| 1 | 2018-11-04 03:01:00.000 |
+----+-------------------------+