{"record":{"id":"74b8fb41c512d295","repo":"jackc/pgx","slug":"cannot-scan-infinity-into-time-time","errorCode":null,"errorMessage":"cannot scan Infinity into *time.Time","messagePattern":"cannot scan Infinity into \\*time\\.Time","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/builtin_wrappers.go","lineNumber":410,"sourceCode":"}\n\nfunc (w stringWrapper) TextValue() (Text, error) {\n\treturn Text{String: string(w), Valid: true}, nil\n}\n\ntype timeWrapper time.Time\n\nfunc (w *timeWrapper) ScanDate(v Date) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *time.Time\")\n\t}\n\n\tswitch v.InfinityModifier {\n\tcase Finite:\n\t\t*w = timeWrapper(v.Time)\n\t\treturn nil\n\tcase Infinity:\n\t\treturn fmt.Errorf(\"cannot scan Infinity into *time.Time\")\n\tcase NegativeInfinity:\n\t\treturn fmt.Errorf(\"cannot scan -Infinity into *time.Time\")\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid InfinityModifier: %v\", v.InfinityModifier)\n\t}\n}\n\nfunc (w timeWrapper) DateValue() (Date, error) {\n\treturn Date{Time: time.Time(w), Valid: true}, nil\n}\n\nfunc (w *timeWrapper) ScanTimestamp(v Timestamp) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *time.Time\")\n\t}\n\n\tswitch v.InfinityModifier {\n\tcase Finite:","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/builtin_wrappers.go#L392-L428","documentation":"ScanDate received a Date with InfinityModifier == Infinity, which time.Time cannot represent. PostgreSQL's infinite date was returned but the destination *time.Time only supports finite values; use pgtype.Date to handle infinity.","triggerScenarios":"Thrown at pgtype/builtin_wrappers.go:410 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Scan into pgtype.Date, which supports InfinityModifier","Filter or transform infinite values in the query (e.g. NULLIF/case expression)","Constrain the column to finite dates"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}