Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/redshift/redshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,13 @@ func GetRedshiftDataType(sqlType, debeziumType, sourceColType,
}
}

// BIGINT UNSIGNED propagates no column length, and the default
// numeric(18,0) cannot hold its full range: COPY fails with
// "Overflow for NUMERIC(18,0)". Size it to 20 digits.
if sourceColType == "bigint unsigned" && sourceColLength == "" {
sourceColLength = "20"
}

return applyLength(
RedshiftToMysqlCharacterRatio,
redshiftType,
Expand Down
33 changes: 33 additions & 0 deletions pkg/redshift/redshift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,39 @@ func TestRedshiftDataTypeGet(t *testing.T) {
expectedResult: "boolean",
expectError: false,
},
{
name: "test29: BIGINT UNSIGNED without length covers full range",
sqlType: "mysql",
debeziumType: "string",
sourceColType: "BIGINT UNSIGNED",
sourceColLength: "",
sourceColScale: "",
columnMasked: false,
expectedResult: "numeric(20,0)",
expectError: false,
},
{
name: "test30: BIGINT UNSIGNED with explicit length is respected",
sqlType: "mysql",
debeziumType: "string",
sourceColType: "BIGINT UNSIGNED",
sourceColLength: "22",
sourceColScale: "",
columnMasked: false,
expectedResult: "numeric(22,0)",
expectError: false,
},
{
name: "test31: BIGINT UNSIGNED masked stays varchar",
sqlType: "mysql",
debeziumType: "string",
sourceColType: "BIGINT UNSIGNED",
sourceColLength: "",
sourceColScale: "",
columnMasked: true,
expectedResult: "character varying(50)",
expectError: false,
},
}

for _, tc := range tests {
Expand Down
1 change: 0 additions & 1 deletion pkg/redshiftloader/load_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ func (b *loadProcessor) migrateTable(
if err != nil {
return err
}
return err
}

err = tx.Commit()
Expand Down