From f4ab860baf4c253a43cedccfc1e9074685cefc6f Mon Sep 17 00:00:00 2001 From: Amogh Bharadwaj Date: Thu, 8 Feb 2024 02:04:00 +0530 Subject: [PATCH] Set nan inf numeric to nil (#1224) --- flow/connectors/postgres/qvalue_convert.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flow/connectors/postgres/qvalue_convert.go b/flow/connectors/postgres/qvalue_convert.go index fc63bc68cd..ae241ecb57 100644 --- a/flow/connectors/postgres/qvalue_convert.go +++ b/flow/connectors/postgres/qvalue_convert.go @@ -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)