Skip to content

Commit

Permalink
source-mysql: Add tests of zero-valued date/time columns
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
willdonnelly committed Aug 6, 2024
1 parent 051a050 commit ca8e88d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source-mysql/datatype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca8e88d

Please sign in to comment.