diff --git a/dm/config/task.go b/dm/config/task.go index 6bb649ded9..ff90b842dd 100644 --- a/dm/config/task.go +++ b/dm/config/task.go @@ -827,5 +827,8 @@ func AdjustTargetDBTimeZone(config *DBConfig) { return } } + if config.Session == nil { + config.Session = make(map[string]string, 1) + } config.Session["time_zone"] = defaultTimeZone } diff --git a/tests/all_mode/data/db2.prepare.sql b/tests/all_mode/data/db2.prepare.sql index 10199a4381..fc8900ae73 100644 --- a/tests/all_mode/data/db2.prepare.sql +++ b/tests/all_mode/data/db2.prepare.sql @@ -6,8 +6,7 @@ create table t2 ( name varchar(20), ts timestamp, PRIMARY KEY (id));; -insert into t2 (name, ts) values ('Arya', now()), ('Bran', '2021-05-11 10:01:05'); -insert into t2 (name) values ('Sansa'); +insert into t2 (name, ts) values ('Arya', now()), ('Bran', '2021-05-11 10:01:05'), ('Sansa', NULL); -- test block-allow-list drop database if exists `ignore_db`;