{"record":{"id":"2e7d5d0b276651c8","repo":"SeaQL/sea-orm","slug":"failed-to-get-oid-array","errorCode":null,"errorMessage":"Failed to get oid array","messagePattern":"Failed to get oid array","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_postgres.rs","lineNumber":630,"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":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_postgres.rs#L612-L648","documentation":"This panic is raised when sea-orm cannot decode an OID[] (oid array) column into Option<Vec<i64>> in its Postgres driver. `try_get` fails when the underlying value is not an oid array, an array element type sqlx cannot decode, or the driver/feature setup doesn't match the runtime wire format. The `.expect` escalates the sqlx error to a panic during row conversion.","triggerScenarios":"Selecting an oid[] column (e.g. pg_type.oid lists, aclitem-related arrays, `proargtypes`) with `postgres-array` feature enabled when the array element OID is unknown to sqlx, or the column was cast/aliased in SQL so the wire type is text[]/bytea instead of oid[].","commonSituations":"Catalog-driven tooling reading pg_proc.proargtypes or similar oid vectors; raw SQL casting oid[] to text[] for logging then trying to load it back through the entity; newer Postgres versions introducing types sqlx doesn't know.","solutions":["Cast the array explicitly to bigint[] in SQL: `SELECT proargtypes::bigint[] FROM pg_proc`.","Verify the element type with `SELECT pg_typeof(col)`; ensure it is `oid[]` and not text[]/bytea[] like `proacl`.","Update sqlx/sea-orm to versions that support the oid element type in arrays.","Bypass sea-orm's typed decode for catalog columns and select them as text (`col::text`) if you only need display."],"exampleFix":"// before\nSELECT proargtypes FROM pg_proc;\n\n// after\nSELECT proargtypes::bigint[] AS proargtypes FROM pg_proc;","handlingStrategy":"validation","validationCode":"// Verify the array element type before selecting oid[] columns:\nlet t = db.query_one(Statement::from_string(\n    DatabaseBackend::Postgres,\n    \"SELECT format_type(a.atttypid, a.atttypmod) FROM pg_attribute a WHERE a.attrelid = 'pg_proc'::regclass AND a.attname = 'proargtypes'\",\n)).await?;\n// expect \"oid[]\"","typeGuard":null,"tryCatchPattern":"// Fall back to a bigint[] cast in a catch_unwind boundary:\nlet result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(||\n    db.query_all(Statement::from_string(DatabaseBackend::Postgres, \"SELECT proargtypes::bigint[] FROM pg_proc\"))\n));","preventionTips":["Cast oid[] columns to bigint[] in raw SQL for a predictable wire type.","Distinguish oid[] from bytea[] columns like proacl when introspecting catalogs.","Enable the postgres-array feature only when actually querying array columns.","Test catalog queries against your target Postgres version."],"tags":["postgres","type-decoding","panic","oid-array","sea-orm"],"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"}