{"record":{"id":"d57b83a07295833b","repo":"SeaQL/sea-orm","slug":"failed-to-get-double-array-d57b83","errorCode":null,"errorMessage":"Failed to get double array","messagePattern":"Failed to get double array","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_postgres.rs","lineNumber":546,"sourceCode":"                            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\"),\n                        ),\n                        #[cfg(feature = \"postgres-array\")]\n                        \"VARCHAR[]\" | \"CHAR[]\" | \"TEXT[]\" | \"NAME[]\" => Value::Array(\n                            sea_query::ArrayType::String,\n                            row.try_get::<Option<Vec<String>>, _>(c.ordinal())\n                                .expect(\"Failed to get string array\")","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_postgres.rs#L528-L564","documentation":"This panic comes from `.expect(\"Failed to get double array\")` in ProxyRow's PostgreSQL driver (src/driver/sqlx_postgres.rs:546). For columns typed FLOAT8[]/DOUBLE PRECISION[] (behind the `postgres-array` feature), the code decodes `Option<Vec<f64>>`; if sqlx cannot decode the array into Vec<f64> it panics. Usually the array element type is not truly float8, or the value is not an array at all.","triggerScenarios":"Calling `ConnExec`/query through the proxy driver against a float8[] column when the underlying value is a scalar, a text array (e.g. produced by array_to_string), or an array of another numeric type (numeric[] cast to float8[] only in the type name), or the `postgres-array` sqlx feature isn't enabled so arrays fail to decode.","commonSituations":"Missing `postgres-array` feature flag on the sqlx/sea-orm dependency, expressions like array_agg returning a differently typed array, comparing the schema's cached column metadata against a changed table, or Postgres extension types that report as float8[] but decode differently.","solutions":["Ensure the `postgres-array` feature is enabled consistently on both sea-orm and sqlx in Cargo.toml.","Verify the column is genuinely float8[] (`SELECT array_typeof(col) FROM ...`) and cast in SQL (`col::float8[]`) if the element type differs.","Update sea-orm and sqlx to matching versions and rebuild; array decoding changed between sqlx releases.","Enable RUST_LOG=sqlx=debug to capture the real decode error and offending column before the expect.","Replace the expect with an error mapped to DbErr::Custom including the column ordinal."],"exampleFix":"// Cargo.toml\n// before\nsea-orm = { version = \"1\", features = [\"sqlx-postgres\"] }\n// after\nsea-orm = { version = \"1\", features = [\"sqlx-postgres\", \"postgres-array\"] }","handlingStrategy":"validation","validationCode":"// Verify array element type before reading:\n// SELECT array_typeof(col) FROM t LIMIT 1;  -- expect 'double precision'\n// Or cast: SELECT col::float8[] FROM ...","typeGuard":"fn is_float8_array_col(c: &ProxyColumn) -> bool {\n    matches!(c.ty.as_str(), \"FLOAT8[]\" | \"DOUBLE PRECISION[]\")\n}","tryCatchPattern":"std::panic::catch_unwind(|| read_row(row))\n    .map_err(|p| DbErr::Custom(format!(\"float8[] decode panic: {p:?}\")))?;","preventionTips":["Enable the `postgres-array` feature on sea-orm and sqlx.","Cast arrays in SQL (`::float8[]`) when the element type is uncertain.","Test array columns after every schema migration.","Keep sea-orm/sqlx versions aligned.","Use array_typeof checks in data validation queries."],"tags":["postgres","sqlx","array","type-mismatch","panic"],"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"}