From 1f7d701c2794b814c8abbe48810c7974573b286c Mon Sep 17 00:00:00 2001 From: Eitam Date: Thu, 7 Apr 2022 13:04:16 +0300 Subject: [PATCH] Change decodeTimestamp2 to return nil in case sec = 0 --- replication/row_event.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/replication/row_event.go b/replication/row_event.go index 9b3ec4700..3b64f6620 100644 --- a/replication/row_event.go +++ b/replication/row_event.go @@ -1068,12 +1068,8 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{ }) } case MYSQL_TYPE_TIMESTAMP2: - if meta == 0 { - v = nil - } else { - v, n, err = decodeTimestamp2(data, meta, e.timestampStringLocation) - v = e.parseFracTime(v) - } + v, n, err = decodeTimestamp2(data, meta, e.timestampStringLocation) + v = e.parseFracTime(v) case MYSQL_TYPE_DATETIME: n = 8 i64 := binary.LittleEndian.Uint64(data) @@ -1399,7 +1395,7 @@ func decodeTimestamp2(data []byte, dec uint16, timestampStringLocation *time.Loc } if sec == 0 { - return formatZeroTime(int(usec), int(dec)), n, nil + return nil, n, nil } return fracTime{