{"id":"beee2fdfc78a2c87","repo":"jackc/pgx","slug":"timestamptz-w","errorCode":null,"errorMessage":"timestamptz: %w","messagePattern":"timestamptz: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/timestamptz.go","lineNumber":258,"sourceCode":"\t\t\treturn &scanPlanTextTimestamptzToTimestamptzScanner{location: c.ScanLocation}\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype scanPlanBinaryTimestamptzToTimestamptzScanner struct{ location *time.Location }\n\nfunc (plan *scanPlanBinaryTimestamptzToTimestamptzScanner) Scan(src []byte, dst any) error {\n\tscanner := (dst).(TimestamptzScanner)\n\n\tif src == nil {\n\t\treturn scanner.ScanTimestamptz(Timestamptz{})\n\t}\n\n\traw, err := pgio.Uint64Exact(src)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"timestamptz: %w\", err)\n\t}\n\n\tvar tstz Timestamptz\n\tmicrosecSinceY2K := int64(raw)\n\n\tswitch microsecSinceY2K {\n\tcase infinityMicrosecondOffset:\n\t\ttstz = Timestamptz{Valid: true, InfinityModifier: Infinity}\n\tcase negativeInfinityMicrosecondOffset:\n\t\ttstz = Timestamptz{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*1_000),\n\t\t)\n\t\tif plan.location != nil {\n\t\t\ttim = tim.In(plan.location)\n\t\t}","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/timestamptz.go#L240-L276","documentation":"Error \"timestamptz: %w\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/timestamptz.go:258 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}