jackc/pgx · error

cannot scan NULL into *int64

Error message

cannot scan NULL into *int64

What it means

Error "cannot scan NULL into *int64" thrown in jackc/pgx.

Source

Thrown at pgtype/builtin_wrappers.go:92

	if v.Int64 > math.MaxInt32 {
		return fmt.Errorf("%d is greater than maximum value for int32", v.Int64)
	}
	*w = int32Wrapper(v.Int64)

	return nil
}

func (w int32Wrapper) Int64Value() (Int8, error) {
	return Int8{Int64: int64(w), Valid: true}, nil
}

type int64Wrapper int64

func (w int64Wrapper) SkipUnderlyingTypePlan() {}

func (w *int64Wrapper) ScanInt64(v Int8) error {
	if !v.Valid {
		return fmt.Errorf("cannot scan NULL into *int64")
	}

	*w = int64Wrapper(v.Int64)

	return nil
}

func (w int64Wrapper) Int64Value() (Int8, error) {
	return Int8{Int64: int64(w), Valid: true}, nil
}

type intWrapper int

func (w intWrapper) SkipUnderlyingTypePlan() {}

func (w *intWrapper) ScanInt64(v Int8) error {
	if !v.Valid {
		return fmt.Errorf("cannot scan NULL into *int")

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/builtin_wrappers.go:92 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/96072f912afa8484.json. Report an issue: GitHub.