{"record":{"id":"371edfe7ea59fc02","repo":"SeaQL/sea-orm","slug":"failed-to-get-double-371edf","errorCode":null,"errorMessage":"Failed to get double","messagePattern":"Failed to get double","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_postgres.rs","lineNumber":527,"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":509,"sourceCodeEnd":545,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_postgres.rs#L509-L545","documentation":"This panic comes from `.expect(\"Failed to get double\")` in `ProxyRow`, where a Postgres column typed FLOAT8/DOUBLE PRECISION is decoded via `row.try_get` into an `Option<f64>`. It fires when sqlx's decode fails for that column -- the runtime column type OID does not match `float8` (e.g. the column is actually NUMERIC or REAL), or a domain/extension type reports a matching name but a different wire format. Since `expect` is used, the panic aborts the query rather than returning an error.","triggerScenarios":"Any SeaORM query returning a DOUBLE PRECISION column that sqlx cannot decode as f64 -- usually because the column's real type was altered (e.g. to NUMERIC) after the entity/model was written, or the value arrives through a view/cast with a different type.","commonSituations":"`ALTER TABLE ... ALTER COLUMN x TYPE NUMERIC(10,2)` for money precision while the model still says f64. Columns exposed through views with implicit casts. sqlx/sea-orm version skew changing decode behavior. Domains over float8 that sqlx cannot decode natively.","solutions":["Confirm the actual column type in the database matches FLOAT8/DOUBLE PRECISION; ALTER the column or change the entity field to the matching Rust type (e.g. Decimal for NUMERIC).","Cast in the SQL: `SELECT x::DOUBLE PRECISION AS x` so decode receives a float8.","Update/align sea-orm and sqlx versions if a recent dependency bump changed type mappings.","For NUMERIC precision requirements, enable `with-rust_decimal`/`with-bigdecimal` and map the field to a decimal type instead of f64."],"exampleFix":"// before: model uses f64 but the column was altered to NUMERIC\npub amount: f64,\n\n// after: map the NUMERIC column to a decimal type\n#[sea_orm(column_type = \"Decimal(Some((10, 2)))\")]\npub amount: Decimal,","handlingStrategy":"validation","validationCode":"let row: (String,) = sqlx::query_as(\n    \"SELECT data_type FROM information_schema.columns WHERE table_name = $1 AND column_name = $2\"\n).bind(\"my_table\").bind(\"amount\").fetch_one(&db).await?;\nassert!(matches!(row.0.as_str(), \"double precision\"), \"amount must be DOUBLE PRECISION, got {}\", row.0);","typeGuard":"fn as_f64(v: &sea_orm::Value) -> Option<f64> {\n    match v {\n        sea_orm::Value::Double(x) => *x,\n        _ => None,\n    }\n}","tryCatchPattern":null,"preventionTips":["Run all schema changes through SeaORM migrations to keep entity and column types in lockstep.","Choose f64 only for float8 columns; use Decimal types for NUMERIC precision requirements.","Check `\\d table` after manual DB interventions in production.","Use ::DOUBLE PRECISION casts in raw SQL when types are uncertain."],"tags":["postgres","sqlx","type-mismatch","panic","decode"],"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"}