Reintroduce Uint64 literal constructor for postgres dialect.

This commit is contained in:
go-jet 2025-03-04 19:57:42 +01:00
parent 7047de44a9
commit 33c1d9e663
4 changed files with 24 additions and 1 deletions

View file

@ -3,6 +3,7 @@ package postgres
import (
"github.com/go-jet/jet/v2/internal/utils/ptr"
"github.com/stretchr/testify/assert"
"math"
"github.com/go-jet/jet/v2/qrm"
"testing"
@ -715,6 +716,18 @@ LIMIT $38;
testutils.AssertJSONFile(t, dest, "./testdata/results/common/float_operators.json")
}
func TestUInt64Overflow(t *testing.T) {
stmt := AllTypes.INSERT(AllTypes.BigInt).
VALUES(Uint64(math.MaxUint64))
_, err := stmt.Exec(db)
if isPgxDriver() {
require.ErrorContains(t, err, "18446744073709551615 is greater than maximum value for Int8")
} else {
require.ErrorContains(t, err, "sql: converting argument $1 type: uint64 values with high bit set are not supported")
}
}
func TestIntegerOperators(t *testing.T) {
skipForCockroachDB(t) // some functions are still unimplemented