{"record":{"id":"0f968f0a7894db4a","repo":"SeaQL/sea-orm","slug":"failed-to-get-oid-0f968f","errorCode":null,"errorMessage":"Failed to get oid","messagePattern":"Failed to get oid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_postgres.rs","lineNumber":637,"sourceCode":"                            feature = \"with-rust_decimal\",\n                            not(feature = \"with-bigdecimal\"),\n                            feature = \"postgres-array\"\n                        ))]\n                        \"NUMERIC[]\" => Value::Array(\n                            sea_query::ArrayType::Decimal,\n                            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())","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_postgres.rs#L619-L655","documentation":"SeaORM's ProxyRow maps Postgres OID columns by calling row.try_get::<Option<u32/i64>> with .expect(\"Failed to get oid\"), so any sqlx decode error panics with this message. It means the value in an OID-typed column could not be decoded into the expected integer type — usually because the column's actual wire type differs from what sqlx expects for OID, or the sqlx/postgres version uses a different OID representation (u32 vs i64).","triggerScenarios":"Calling any SeaORM query (Entity::find, raw query through the Proxy driver) that selects a column whose Postgres type name is \"OID\" when sqlx's try_get on that column returns a type-mismatch or decode error, e.g. the column is a custom domain over oid, or a regenerated driver crate decodes OID as u32 while this code expects the Option<i64> path.","commonSituations":"Selecting system catalog columns (e.g. pg_class.relfilenode, pg_type.oid) via Proxy; schema drift after a migration changed the column type; mixing sea-orm and sqlx minor versions with incompatible postgres type codec expectations.","solutions":["Inspect the actual Postgres column type (SELECT column_name, data_type, udt_name FROM information_schema.columns ...) and make sure it is truly oid/int8-compatible.","Cast the column in SQL to a supported type: SELECT my_oid_col::bigint AS my_oid_col.","Align sea-orm and sqlx versions in Cargo.toml so their Postgres OID codecs agree.","If you maintain the driver code, replace .expect with a mapped error or a fallback Value::BigInt(None) so a decode failure is reported, not panicked."],"exampleFix":"// before\n\"OID\" => Value::BigInt(row.try_get(c.ordinal()).expect(\"Failed to get oid\")),\n// after\n\"OID\" => Value::BigInt(row\n    .try_get::<Option<i64>, _>(c.ordinal())\n    .map_err(|e| DbErr::TryIntoError { value_type: \"oid\".into(), source: e.into() })?),","handlingStrategy":"validation","validationCode":"// Check the real column type before querying through the proxy\nlet rows: Vec<(String, String)> = sqlx::query_as(\n    \"SELECT column_name, udt_name FROM information_schema.columns \\\n     WHERE table_name = $1 AND udt_name NOT IN ('oid')\",\n)\n.bind(\"my_table\")\n.fetch_all(&pool)\n.await?;\nassert!(rows.is_empty(), \"non-oid columns misreported: {:?}\", rows);","typeGuard":"fn is_oid_type(udt_name: &str) -> bool { matches!(udt_name, \"oid\" | \"xid\") }","tryCatchPattern":null,"preventionTips":["Cast oid-like columns to bigint in SELECTs that go through the Proxy driver","Keep sea-orm and sqlx on versions tested together in the same lockfile","Prefer explicit column types in migrations over domains wrapping oid","Check information_schema.udt_name before adding columns to proxy queries"],"tags":["rust","sqlx","postgres","panic","type-mismatch"],"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"}