jackc/pgx · error

%d is less than minimum value for Int8

Error message

%d is less than minimum value for Int8

What it means

Error "%d is less than minimum value for Int8" thrown in jackc/pgx.

Source

Thrown at pgtype/int.go:1197

	n := int64(int32(raw))

	return s.ScanText(Text{String: strconv.FormatInt(n, 10), Valid: true})
}

type Int8 struct {
	Int64 int64
	Valid bool
}

// ScanInt64 implements the [Int64Scanner] interface.
func (dst *Int8) ScanInt64(n Int8) error {
	if !n.Valid {
		*dst = Int8{}
		return nil
	}

	if n.Int64 < math.MinInt64 {
		return fmt.Errorf("%d is less than minimum value for Int8", n.Int64)
	}
	if n.Int64 > math.MaxInt64 {
		return fmt.Errorf("%d is greater than maximum value for Int8", n.Int64)
	}
	*dst = Int8{Int64: int64(n.Int64), Valid: true}

	return nil
}

// Int64Value implements the [Int64Valuer] interface.
func (n Int8) Int64Value() (Int8, error) {
	return Int8{Int64: int64(n.Int64), Valid: n.Valid}, nil
}

// Scan implements the [database/sql.Scanner] interface.
func (dst *Int8) Scan(src any) error {
	if src == nil {
		*dst = Int8{}

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/int.go:1197 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/da2bfa5df69a8e0a.json. Report an issue: GitHub.