{"record":{"id":"4e6f6981c96cf7aa","repo":"jackc/pgx","slug":"cannot-scan-null-into-float64","errorCode":null,"errorMessage":"cannot scan NULL into *float64","messagePattern":"cannot scan NULL into \\*float64","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/builtin_wrappers.go","lineNumber":351,"sourceCode":"\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}\n\ntype float64Wrapper float64\n\nfunc (w float64Wrapper) SkipUnderlyingTypePlan() {}\n\nfunc (w *float64Wrapper) ScanInt64(v Int8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *float64\")\n\t}\n\n\t*w = float64Wrapper(v.Int64)\n\n\treturn nil\n}\n\nfunc (w float64Wrapper) 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 *float64Wrapper) ScanFloat64(v Float8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *float64\")","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/builtin_wrappers.go#L333-L369","documentation":"ScanInt64 was given a NULL Int8 while scanning into *float64, which cannot represent NULL. Null guard in float64Wrapper's conversion path; the column value is NULL but the Go destination is a non-nullable float64.","triggerScenarios":"Thrown at pgtype/builtin_wrappers.go:351 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use COALESCE in the query to supply a default","Scan into pgtype.Float8 or *float64 pointer to handle NULLs","Ensure the queried column is NOT NULL"],"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"}