{"record":{"id":"cb86fa9b2abfcec1","repo":"jackc/pgx","slug":"f-is-greater-than-maximum-value-for-int64","errorCode":null,"errorMessage":"%f is greater than maximum value for int64","messagePattern":"(.+?) is greater than maximum value for int64","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/builtin_wrappers.go","lineNumber":325,"sourceCode":"}\n\ntype float32Wrapper float32\n\nfunc (w float32Wrapper) SkipUnderlyingTypePlan() {}\n\nfunc (w *float32Wrapper) ScanInt64(v Int8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *float32\")\n\t}\n\n\t*w = float32Wrapper(v.Int64)\n\n\treturn nil\n}\n\nfunc (w float32Wrapper) Int64Value() (Int8, error) {\n\tif w > math.MaxInt64 {\n\t\treturn Int8{}, fmt.Errorf(\"%f is greater than maximum value for int64\", w)\n\t}\n\n\treturn Int8{Int64: int64(w), Valid: true}, nil\n}\n\nfunc (w *float32Wrapper) ScanFloat64(v Float8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *float32\")\n\t}\n\n\t*w = float32Wrapper(v.Float64)\n\n\treturn nil\n}\n\nfunc (w float32Wrapper) Float64Value() (Float8, error) {\n\treturn Float8{Float64: float64(w), Valid: true}, nil\n}","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/builtin_wrappers.go#L307-L343","documentation":"Returned by float32Wrapper.Int64Value when the wrapped float32 value is greater than math.MaxInt64 and therefore cannot be converted to an Int8 for encoding. Integer conversion of such a large float is undefined in Go.","triggerScenarios":"Thrown at pgtype/builtin_wrappers.go:325 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Store the value in a float column (float4/float8) instead of an integer column","Clamp or reject values exceeding int64 range before encoding","Use pgtype.Float8 which never converts to int internally"],"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"}