jackc/pgx · error
cannot scan Infinity into *time.Time
Error message
cannot scan Infinity into *time.Time
What it means
Error "cannot scan Infinity into *time.Time" thrown in jackc/pgx.
Source
Thrown at pgtype/zeronull/timestamptz.go:28
type Timestamptz time.Time
// SkipUnderlyingTypePlan implements the [pgtype.SkipUnderlyingTypePlanner] interface.
func (Timestamptz) SkipUnderlyingTypePlan() {}
// ScanTimestamptz implements the [pgtype.TimestamptzScanner] interface.
func (ts *Timestamptz) ScanTimestamptz(v pgtype.Timestamptz) error {
if !v.Valid {
*ts = Timestamptz{}
return nil
}
switch v.InfinityModifier {
case pgtype.Finite:
*ts = Timestamptz(v.Time)
return nil
case pgtype.Infinity:
return fmt.Errorf("cannot scan Infinity into *time.Time")
case pgtype.NegativeInfinity:
return fmt.Errorf("cannot scan -Infinity into *time.Time")
default:
return fmt.Errorf("invalid InfinityModifier: %v", v.InfinityModifier)
}
}
// TimestamptzValue implements the [pgtype.TimestamptzValuer] interface.
func (ts Timestamptz) TimestamptzValue() (pgtype.Timestamptz, error) {
if time.Time(ts).IsZero() {
return pgtype.Timestamptz{}, nil
}
return pgtype.Timestamptz{Time: time.Time(ts), Valid: true}, nil
}
// Scan implements the [database/sql.Scanner] interface.
func (ts *Timestamptz) Scan(src any) error {View on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgtype/zeronull/timestamptz.go:28 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/7925b2ff0b4a4a8d.json.
Report an issue: GitHub.