Skip to content

Commit

Permalink
Set nan inf numeric to nil (#1224)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Feb 9, 2024
1 parent 0dd48b0 commit dc8a444
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flow/connectors/postgres/qvalue_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,13 @@ func parseFieldFromPostgresOID(oid uint32, value interface{}) (qvalue.QValue, er
func numericToRat(numVal *pgtype.Numeric) (*big.Rat, error) {
if numVal.Valid {
if numVal.NaN {
return nil, errors.New("numeric value is NaN")
// set to nil if NaN
return nil, nil
}

switch numVal.InfinityModifier {
case pgtype.NegativeInfinity, pgtype.Infinity:
return nil, errors.New("numeric value is infinity")
return nil, nil
}

rat := new(big.Rat).SetInt(numVal.Int)
Expand Down

0 comments on commit dc8a444

Please sign in to comment.