{"record":{"id":"5fbac5d2d5a9e8e3","repo":"SeaQL/sea-orm","slug":"failed-to-get-oid-array-5fbac5","errorCode":null,"errorMessage":"Failed to get oid array","messagePattern":"Failed to get oid array","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_postgres.rs","lineNumber":643,"sourceCode":"                            row.try_get::<Option<Vec<rust_decimal::Decimal>>, _>(c.ordinal())\n                                .expect(\"Failed to get numeric array\")\n                                .map(|vals| {\n                                    Box::new(\n                                        vals.into_iter()\n                                            .map(|val| Value::Decimal(Some(val)))\n                                            .collect(),\n                                    )\n                                }),\n                        ),\n\n                        \"OID\" => {\n                            Value::BigInt(row.try_get(c.ordinal()).expect(\"Failed to get oid\"))\n                        }\n                        #[cfg(feature = \"postgres-array\")]\n                        \"OID[]\" => Value::Array(\n                            sea_query::ArrayType::BigInt,\n                            row.try_get::<Option<Vec<i64>>, _>(c.ordinal())\n                                .expect(\"Failed to get oid array\")\n                                .map(|vals| {\n                                    Box::new(\n                                        vals.into_iter()\n                                            .map(|val| Value::BigInt(Some(val)))\n                                            .collect(),\n                                    )\n                                }),\n                        ),\n\n                        #[cfg(feature = \"with-json\")]\n                        \"JSON\" | \"JSONB\" => Value::Json(\n                            row.try_get::<Option<serde_json::Value>, _>(c.ordinal())\n                                .expect(\"Failed to get json\")\n                                .map(Box::new),\n                        ),\n                        #[cfg(all(\n                            feature = \"with-json\",\n                            any(feature = \"json-array\", feature = \"postgres-array\")","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_postgres.rs#L625-L661","documentation":"ProxyRow maps Postgres OID[] columns to a Vec<i64> via row.try_get::<Option<Vec<i64>>, _> and .expect(\"Failed to get oid array\"), panicking on any sqlx decode failure. This means the column is reported as an OID array but its elements could not be decoded as i64 — typically an element-type mismatch (u32 OIDs, bigint domains, or a non-array value in an array-typed column).","triggerScenarios":"A query through the postgres Proxy driver selecting a column whose type name is \"OID[]\" where the underlying value is not an array of 64-bit OIDs, e.g. it is a scalar oid (comma-separated text), a domain over oid[], or sqlx's Vec<u32> codec is what actually matches.","commonSituations":"Reading catalog/ACL-style columns (e.g. pg_policy.polroles is oid2vector, not a plain array); migrations that changed an array column's element type; version drift between sqlx and sea-orm changing array codecs.","solutions":["Verify the real column type with information_schema/psql \\d and confirm it is a genuine oid[] (udt_name like _oid).","Cast in SQL to a plain array: SELECT my_col::bigint[] AS my_col.","Align sqlx and sea-orm versions so array decode expectations match.","In driver code, map the sqlx error to DbErr instead of .expect so the offending column/ordinal is reported."],"exampleFix":"// before\n.expect(\"Failed to get oid array\")\n// after\n.map_err(|e| DbErr::TryIntoError { value_type: \"oid[]\".into(), source: e.into() })?","handlingStrategy":"validation","validationCode":"let udt: (String,) = sqlx::query_as(\n    \"SELECT udt_name FROM information_schema.columns WHERE table_name=$1 AND column_name=$2\",\n)\n.bind(\"my_table\").bind(\"roles\").fetch_one(&pool).await?;\nassert_eq!(udt.0, \"_oid\", \"expected real oid[] column\");","typeGuard":"fn is_oid_array(udt_name: &str) -> bool { udt_name == \"_oid\" }","tryCatchPattern":null,"preventionTips":["Ensure catalog-style array columns are true arrays, not oid2vector/commas-in-text","Cast to ::bigint[] in SQL when element types are uncertain","Avoid custom domains over oid[] in schemas read through the proxy","Pin a single sqlx version to keep array codecs consistent"],"tags":["rust","sqlx","postgres","panic","array"],"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"}