{"record":{"id":"f3ba6c2c176abab2","repo":"SeaQL/sea-orm","slug":"failed-to-get-double-f3ba6c","errorCode":null,"errorMessage":"Failed to get double","messagePattern":"Failed to get double","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_postgres.rs","lineNumber":540,"sourceCode":"                        \"FLOAT4\" | \"REAL\" => {\n                            Value::Float(row.try_get(c.ordinal()).expect(\"Failed to get float\"))\n                        }\n                        #[cfg(feature = \"postgres-array\")]\n                        \"FLOAT4[]\" | \"REAL[]\" => Value::Array(\n                            sea_query::ArrayType::Float,\n                            row.try_get::<Option<Vec<f32>>, _>(c.ordinal())\n                                .expect(\"Failed to get float array\")\n                                .map(|vals| {\n                                    Box::new(\n                                        vals.into_iter()\n                                            .map(|val| Value::Float(Some(val)))\n                                            .collect(),\n                                    )\n                                }),\n                        ),\n\n                        \"FLOAT8\" | \"DOUBLE PRECISION\" => {\n                            Value::Double(row.try_get(c.ordinal()).expect(\"Failed to get double\"))\n                        }\n                        #[cfg(feature = \"postgres-array\")]\n                        \"FLOAT8[]\" | \"DOUBLE PRECISION[]\" => Value::Array(\n                            sea_query::ArrayType::Double,\n                            row.try_get::<Option<Vec<f64>>, _>(c.ordinal())\n                                .expect(\"Failed to get double array\")\n                                .map(|vals| {\n                                    Box::new(\n                                        vals.into_iter()\n                                            .map(|val| Value::Double(Some(val)))\n                                            .collect(),\n                                    )\n                                }),\n                        ),\n\n                        \"VARCHAR\" | \"CHAR\" | \"TEXT\" | \"NAME\" => Value::String(\n                            row.try_get::<Option<String>, _>(c.ordinal())\n                                .expect(\"Failed to get string\"),","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_postgres.rs#L522-L558","documentation":"This panic is raised by an `.expect(\"Failed to get double\")` in sea-orm's ProxyRow driver for PostgreSQL (src/driver/sqlx_postgres.rs:540). When a column's reported type is FLOAT8/DOUBLE PRECISION, the code calls `row.try_get::<Option<f64>>` on the underlying sqlx row, and panics if sqlx cannot decode the value into f64. Typical root causes are the column actually holding a different type (e.g. numeric/text/NaN) or an sqlx version mismatch in type decoding.","triggerScenarios":"Selecting a float8/double precision column whose actual wire value cannot decode to f64: e.g. the column was ALTERed to another type but the cached type name still says FLOAT8, a NaN/Infinity value with an sqlx version that rejects it into Option<f64>, or a view/expression whose result type differs from the declared FLOAT8.","commonSituations":"Schema drift after migrations (type renamed but query results re-decoded), using raw SQL views that return text or numeric under a float8 alias, mismatched sea-orm/sqlx versions where decoding behavior changed, or a proxy driver (sea-orm-proxy / sharding) reading a foreign table with incompatible type mapping.","solutions":["Check the actual column type with `\\d table` or information_schema and confirm it is really float8/double precision; fix the schema or cast in SQL (`SELECT col::float8`).","Align sea-orm and sqlx versions (same minor line) and rebuild so the type decoding matches; sqlx decode behavior for float8 has changed across versions.","Enable sqlx logging (RUST_LOG=sqlx=debug) and reproduce to see the underlying sqlx decode error message identifying the column and expected/received types.","If the value can legitimately be NaN/Infinity, cast to text or numeric in the query and read it via a supported type instead of f64.","As a last resort, patch the expect to map the error and report the column name instead of panicking."],"exampleFix":"// before\n\"FLOAT8\" | \"DOUBLE PRECISION\" => Value::Double(\n    row.try_get(c.ordinal()).expect(\"Failed to get double\"),\n)\n// after (query-side cast so sqlx sees a real float8)\nlet value: Option<f64> = row.try_get(c.ordinal())\n    .map_err(|e| DbErr::Custom(format!(\"float8 decode failed at col {}: {e}\", c.ordinal())))?;","handlingStrategy":"validation","validationCode":"// Before reading, verify the column really is float8 in Postgres:\n// SELECT data_type FROM information_schema.columns\n//   WHERE table_name=$1 AND column_name=$2;  -- expect 'double precision'\n// Or cast defensively in the query: SELECT col::float8 FROM ...","typeGuard":"fn is_float8_col(c: &ProxyColumn) -> bool {\n    matches!(c.ty.as_str(), \"FLOAT8\" | \"DOUBLE PRECISION\")\n}","tryCatchPattern":"// expect() panics, so guard the process instead:\nstd::panic::catch_unwind(|| row_proxy_query(db, sql))\n    .map_err(|p| DbErr::Custom(format!(\"decode panic: {p:?}\")))?;","preventionTips":["Cast ambiguous columns in SQL (`::float8`) so the wire type matches the decoder.","Keep sea-orm and sqlx on matching versions and rebuild after upgrades.","Run information_schema checks against expected types in migration tests.","Avoid storing NaN/Infinity in float8 columns read through the proxy driver.","Enable RUST_LOG=sqlx=debug in CI to surface decode errors early."],"tags":["postgres","sqlx","type-mismatch","panic","driver"],"backgroundTag":"type-mismatch","analyzedSha":"e29bcd1b417c41a553b386fe94511d7c64a1c8ec","analyzedAt":"2026-09-10T11:31:52.468Z","contentChangedAt":"2026-09-10T11:31:52.468Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}