jackc/pgx · error
%d microseconds cannot be represented as time.Time
Error message
%d microseconds cannot be represented as time.Time
What it means
Error "%d microseconds cannot be represented as time.Time" thrown in jackc/pgx.
Source
Thrown at pgtype/builtin_wrappers.go:474
return fmt.Errorf("cannot scan -Infinity into *time.Time")
default:
return fmt.Errorf("invalid InfinityModifier: %v", v.InfinityModifier)
}
}
func (w timeWrapper) TimestamptzValue() (Timestamptz, error) {
return Timestamptz{Time: time.Time(w), Valid: true}, nil
}
func (w *timeWrapper) ScanTime(v Time) error {
if !v.Valid {
return fmt.Errorf("cannot scan NULL into *time.Time")
}
// 24:00:00 is max allowed time in PostgreSQL, but time.Time will normalize that to 00:00:00 the next day.
var maxRepresentableByTime int64 = 24*60*60*1000000 - 1
if v.Microseconds > maxRepresentableByTime {
return fmt.Errorf("%d microseconds cannot be represented as time.Time", v.Microseconds)
}
usec := v.Microseconds
hours := usec / microsecondsPerHour
usec -= hours * microsecondsPerHour
minutes := usec / microsecondsPerMinute
usec -= minutes * microsecondsPerMinute
seconds := usec / microsecondsPerSecond
usec -= seconds * microsecondsPerSecond
ns := usec * 1000
*w = timeWrapper(time.Date(2000, 1, 1, int(hours), int(minutes), int(seconds), int(ns), time.UTC))
return nil
}
func (w timeWrapper) TimeValue() (Time, error) {
t := time.Time(w)
usec := int64(t.Hour())*microsecondsPerHour +
int64(t.Minute())*microsecondsPerMinute +View on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgtype/builtin_wrappers.go:474 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/d2a046b565cc3b70.json.
Report an issue: GitHub.