From ab3c679d529dd20d44e789dc6f1d89f9510bde0b Mon Sep 17 00:00:00 2001 From: Aoang Date: Thu, 5 Dec 2024 19:00:45 +0800 Subject: [PATCH] fix(pgdialect): remove unsigned integer conversion PostgreSQL does not support unsigned integer types. Previously, a Go uint32 type was mapped to the database integer type. When values exceeded the range, they were converted. Even specifying the type as numeric did not prevent this conversion. This update removes the conversion, allowing the database to handle errors appropriately. Fixed uptrace/bun#624 --- dialect/pgdialect/dialect.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/dialect/pgdialect/dialect.go b/dialect/pgdialect/dialect.go index cdca0444..2180e6ab 100644 --- a/dialect/pgdialect/dialect.go +++ b/dialect/pgdialect/dialect.go @@ -3,7 +3,6 @@ package pgdialect import ( "database/sql" "fmt" - "strconv" "strings" "github.com/uptrace/bun" @@ -128,14 +127,6 @@ func (d *Dialect) IdentQuote() byte { return '"' } -func (d *Dialect) AppendUint32(b []byte, n uint32) []byte { - return strconv.AppendInt(b, int64(int32(n)), 10) -} - -func (d *Dialect) AppendUint64(b []byte, n uint64) []byte { - return strconv.AppendInt(b, int64(n), 10) -} - func (d *Dialect) AppendSequence(b []byte, _ *schema.Table, _ *schema.Field) []byte { return appendGeneratedAsIdentity(b) }