jackc/pgx · error

%d is greater than maximum value for uint32

Error message

%d is greater than maximum value for uint32

What it means

Error "%d is greater than maximum value for uint32" thrown in jackc/pgx.

Source

Thrown at pgtype/uint32.go:176

}

type encodePlanUint32CodecBinaryInt64Valuer struct{}

func (encodePlanUint32CodecBinaryInt64Valuer) Encode(value any, buf []byte) (newBuf []byte, err error) {
	v, err := value.(Int64Valuer).Int64Value()
	if err != nil {
		return nil, err
	}

	if !v.Valid {
		return nil, nil
	}

	if v.Int64 < 0 {
		return nil, fmt.Errorf("%d is less than minimum value for uint32", v.Int64)
	}
	if v.Int64 > math.MaxUint32 {
		return nil, fmt.Errorf("%d is greater than maximum value for uint32", v.Int64)
	}

	return pgio.AppendUint32(buf, uint32(v.Int64)), nil
}

type encodePlanUint32CodecTextUint32 struct{}

func (encodePlanUint32CodecTextUint32) Encode(value any, buf []byte) (newBuf []byte, err error) {
	v := value.(uint32)
	return append(buf, strconv.FormatUint(uint64(v), 10)...), nil
}

type encodePlanUint32CodecTextUint32Valuer struct{}

func (encodePlanUint32CodecTextUint32Valuer) Encode(value any, buf []byte) (newBuf []byte, err error) {
	v, err := value.(Uint32Valuer).Uint32Value()
	if err != nil {
		return nil, err

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/uint32.go:176 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jackc/pgx@ec1a0befd2 (2026-08-04). Data as JSON: /data/errors/96a003364104489a.json. Report an issue: GitHub.