2
0

Fix encoding uint64 larger than math.MaxInt64 into numeric

fixes https://github.com/jackc/pgx/issues/1357
This commit is contained in:
Jack Christensen
2022-10-29 08:47:12 -05:00
parent c00fb5d2a1
commit 6fabd8f5b1
3 changed files with 57 additions and 2 deletions
+2
View File
@@ -110,6 +110,8 @@ func TestNumericCodec(t *testing.T) {
{int64(math.MinInt64 + 1), new(pgtype.Numeric), isExpectedEqNumeric(mustParseNumeric(t, strconv.FormatInt(math.MinInt64+1, 10)))},
{int64(math.MaxInt64), new(pgtype.Numeric), isExpectedEqNumeric(mustParseNumeric(t, strconv.FormatInt(math.MaxInt64, 10)))},
{int64(math.MaxInt64 - 1), new(pgtype.Numeric), isExpectedEqNumeric(mustParseNumeric(t, strconv.FormatInt(math.MaxInt64-1, 10)))},
{uint64(math.MaxUint64), new(uint64), isExpectedEq(uint64(math.MaxUint64))},
{uint(math.MaxUint), new(uint), isExpectedEq(uint(math.MaxUint))},
{"1.23", new(string), isExpectedEq("1.23")},
{pgtype.Numeric{}, new(pgtype.Numeric), isExpectedEq(pgtype.Numeric{})},
{nil, new(pgtype.Numeric), isExpectedEq(pgtype.Numeric{})},