{"id":"7925b2ff0b4a4a8d","repo":"jackc/pgx","slug":"cannot-scan-infinity-into-time-time-7925b2","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/zeronull/timestamptz.go","lineNumber":28,"sourceCode":"\ntype Timestamptz time.Time\n\n// SkipUnderlyingTypePlan implements the [pgtype.SkipUnderlyingTypePlanner] interface.\nfunc (Timestamptz) SkipUnderlyingTypePlan() {}\n\n// ScanTimestamptz implements the [pgtype.TimestamptzScanner] interface.\nfunc (ts *Timestamptz) ScanTimestamptz(v pgtype.Timestamptz) error {\n\tif !v.Valid {\n\t\t*ts = Timestamptz{}\n\t\treturn nil\n\t}\n\n\tswitch v.InfinityModifier {\n\tcase pgtype.Finite:\n\t\t*ts = Timestamptz(v.Time)\n\t\treturn nil\n\tcase pgtype.Infinity:\n\t\treturn fmt.Errorf(\"cannot scan Infinity into *time.Time\")\n\tcase pgtype.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\n// TimestamptzValue implements the [pgtype.TimestamptzValuer] interface.\nfunc (ts Timestamptz) TimestamptzValue() (pgtype.Timestamptz, error) {\n\tif time.Time(ts).IsZero() {\n\t\treturn pgtype.Timestamptz{}, nil\n\t}\n\n\treturn pgtype.Timestamptz{Time: time.Time(ts), Valid: true}, nil\n}\n\n// Scan implements the [database/sql.Scanner] interface.\nfunc (ts *Timestamptz) Scan(src any) error {","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/zeronull/timestamptz.go#L10-L46","documentation":"Error \"cannot scan Infinity into *time.Time\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/zeronull/timestamptz.go:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}