{"id":"9a16a3f9ae126f3d","repo":"jackc/pgx","slug":"timestamp-w","errorCode":null,"errorMessage":"timestamp: %w","messagePattern":"timestamp: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/timestamp.go","lineNumber":267,"sourceCode":"\t\t\treturn &scanPlanTextTimestampToTimestampScanner{location: c.ScanLocation}\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype scanPlanBinaryTimestampToTimestampScanner struct{ location *time.Location }\n\nfunc (plan *scanPlanBinaryTimestampToTimestampScanner) Scan(src []byte, dst any) error {\n\tscanner := (dst).(TimestampScanner)\n\n\tif src == nil {\n\t\treturn scanner.ScanTimestamp(Timestamp{})\n\t}\n\n\traw, err := pgio.Uint64Exact(src)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"timestamp: %w\", err)\n\t}\n\n\tvar ts Timestamp\n\tmicrosecSinceY2K := int64(raw)\n\n\tswitch microsecSinceY2K {\n\tcase infinityMicrosecondOffset:\n\t\tts = Timestamp{Valid: true, InfinityModifier: Infinity}\n\tcase negativeInfinityMicrosecondOffset:\n\t\tts = Timestamp{Valid: true, InfinityModifier: -Infinity}\n\tdefault:\n\t\ttim := time.Unix(\n\t\t\tmicrosecFromUnixEpochToY2K/1_000_000+microsecSinceY2K/1_000_000,\n\t\t\t(microsecFromUnixEpochToY2K%1_000_000*1_000)+(microsecSinceY2K%1_000_000*1000),\n\t\t).UTC()\n\t\tif plan.location != nil {\n\t\t\ttim = time.Date(tim.Year(), tim.Month(), tim.Day(), tim.Hour(), tim.Minute(), tim.Second(), tim.Nanosecond(), plan.location)\n\t\t}","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/timestamp.go#L249-L285","documentation":"Error \"timestamp: %w\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/timestamp.go:267 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}