jackc/pgx · error

range upper bound cannot be NULL

Error message

range upper bound cannot be NULL

What it means

Error "range upper bound cannot be NULL" thrown in jackc/pgx.

Source

Thrown at pgtype/range.go:250

		ubr.UpperType = Inclusive
	case rangeType&upperUnboundedMask > 0:
		ubr.UpperType = Unbounded
	default:
		ubr.UpperType = Exclusive
	}

	if ubr.LowerType != Unbounded {
		val, null := r.Value()
		if null {
			return nil, fmt.Errorf("range lower bound cannot be NULL")
		}
		ubr.Lower = val
	}

	if ubr.UpperType != Unbounded {
		val, null := r.Value()
		if null {
			return nil, fmt.Errorf("range upper bound cannot be NULL")
		}
		ubr.Upper = val
	}

	if err := r.Finish(); err != nil {
		return nil, fmt.Errorf("range: %w", err)
	}

	return ubr, nil
}

// Range is a generic range type.
type Range[T any] struct {
	Lower     T
	Upper     T
	LowerType BoundType
	UpperType BoundType
	Valid     bool

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/range.go:250 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/be87a4f3c5fbc490.json. Report an issue: GitHub.