Skip to content

Commit

Permalink
Merge branch 'main' into snapshot-notid-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal authored Mar 18, 2024
2 parents 6736dc6 + 23539f5 commit aebcef9
Show file tree
Hide file tree
Showing 3 changed files with 2,638 additions and 2,070 deletions.
15 changes: 2 additions & 13 deletions flow/connectors/postgres/qvalue_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,8 @@ func parseFieldFromQValueKind(qvalueKind qvalue.QValueKind, value interface{}) (
case qvalue.QValueKindTime:
timeVal := value.(pgtype.Time)
if timeVal.Valid {
var timeValStr any
timeValStr, err := timeVal.Value()
if err != nil {
return qvalue.QValue{}, fmt.Errorf("failed to parse time: %w", err)
}
// edge case, only Postgres supports this extreme value for time
timeValStr = strings.Replace(timeValStr.(string), "24:00:00.000000", "23:59:59.999999", 1)
t, err := time.Parse("15:04:05.999999", timeValStr.(string))
t = t.AddDate(1970, 0, 0)
if err != nil {
return qvalue.QValue{}, fmt.Errorf("failed to parse time: %w", err)
}
val = qvalue.QValue{Kind: qvalue.QValueKindTime, Value: t}
// 86399999999 to prevent 24:00:00
val = qvalue.QValue{Kind: qvalue.QValueKindTime, Value: time.UnixMicro(min(timeVal.Microseconds, 86399999999))}
}
case qvalue.QValueKindTimeTZ:
timeVal := value.(string)
Expand Down
Loading

0 comments on commit aebcef9

Please sign in to comment.