From ca8e88dd1c83b3302fa68380035afde223a5f306 Mon Sep 17 00:00:00 2001 From: Will Donnelly Date: Mon, 5 Aug 2024 18:49:16 -0500 Subject: [PATCH] source-mysql: Add tests of zero-valued date/time columns Apparently these are special-cased in the binary value encoding and up until a couple months ago there was a bug in how times were handled, so it's worth explicitly verifying these. --- source-mysql/datatype_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source-mysql/datatype_test.go b/source-mysql/datatype_test.go index f4f6b0059a..3b20fb7d1c 100644 --- a/source-mysql/datatype_test.go +++ b/source-mysql/datatype_test.go @@ -89,7 +89,9 @@ func TestDatatypes(t *testing.T) { {ColumnType: "set('a', 'b', 'c')", ExpectType: `{"type":["string","null"]}`, InputValue: "a,c", ExpectValue: `"a,c"`}, {ColumnType: "date", ExpectType: `{"type":["string","null"]}`, InputValue: "1991-08-31", ExpectValue: `"1991-08-31"`}, + {ColumnType: "date", ExpectType: `{"type":["string","null"]}`, InputValue: "0000-00-00", ExpectValue: `"0000-00-00"`}, {ColumnType: "time", ExpectType: `{"type":["string","null"]}`, InputValue: "765:43:21", ExpectValue: `"765:43:21"`}, + {ColumnType: "time", ExpectType: `{"type":["string","null"]}`, InputValue: "00:00:00", ExpectValue: `"00:00:00"`}, {ColumnType: "year", ExpectType: `{"type":["integer","null"]}`, InputValue: "2003", ExpectValue: `2003`}, // The DATETIME column type will be stored verbatim by MySQL, and we will interpret it as being in