{"record":{"id":"5cb9d988ba891dd5","repo":"SeaQL/sea-orm","slug":"failed-to-get-tiny-integer-5cb9d9","errorCode":null,"errorMessage":"Failed to get tiny integer","messagePattern":"Failed to get tiny integer","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_mysql.rs","lineNumber":417,"sourceCode":"                        \"TINYINT UNSIGNED\" => Value::TinyUnsigned(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get unsigned tiny integer\"),\n                        ),\n                        \"SMALLINT UNSIGNED\" => Value::SmallUnsigned(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get unsigned small integer\"),\n                        ),\n                        \"INT UNSIGNED\" => Value::Unsigned(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get unsigned integer\"),\n                        ),\n                        \"MEDIUMINT UNSIGNED\" | \"BIGINT UNSIGNED\" => Value::BigUnsigned(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get unsigned big integer\"),\n                        ),\n                        \"TINYINT\" => Value::TinyInt(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get tiny integer\"),\n                        ),\n                        \"SMALLINT\" => Value::SmallInt(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get small integer\"),\n                        ),\n                        \"INT\" => {\n                            Value::Int(row.try_get(c.ordinal()).expect(\"Failed to get integer\"))\n                        }\n                        \"MEDIUMINT\" | \"BIGINT\" => Value::BigInt(\n                            row.try_get(c.ordinal()).expect(\"Failed to get big integer\"),\n                        ),\n                        \"FLOAT\" => {\n                            Value::Float(row.try_get(c.ordinal()).expect(\"Failed to get float\"))\n                        }\n                        \"DOUBLE\" => {\n                            Value::Double(row.try_get(c.ordinal()).expect(\"Failed to get double\"))\n                        }\n","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_mysql.rs#L399-L435","documentation":"`ProxyRow` decodes MySQL `TINYINT` columns by calling `row.try_get::<i8>` and unwrapping with `.expect(\"Failed to get tiny integer\")`. A decode failure (NULL value, or the value cannot be converted to i8) panics with this message. Note MySQL TINYINT(1) is often used as BOOLEAN, so a bool-typed value in a TINYINT column can also trip this path depending on driver typing.","triggerScenarios":"A TINYINT column that is NULL in the result set, or declared/mocked with a type sqlx will not decode as `i8` (e.g. bool from a TINYINT(1) alias, or string in a mock proxy row), while decoding through the proxy driver.","commonSituations":"Boolean-mapped TINYINT(1) columns decoded through raw SQL bypassing SeaORM's bool mapping; NULL tinyint in LEFT JOIN results; proxy test handlers returning `true/false` for a column described as `TINYINT`.","solutions":["Change the entity field to `Option<i8>` (or `Option<bool>` for TINYINT(1)) so NULL/mismatch is represented safely","For boolean columns, select them through the entity (which maps bool) rather than raw SQL with TINYINT metadata","Fix proxy/mock handlers to emit `i8` values for columns described as TINYINT","Regenerate entities after schema changes to remove type drift"],"exampleFix":"// before\npub flag: i8,\n// after (for a NULLable TINYINT)\npub flag: Option<i8>,","handlingStrategy":"validation","validationCode":"// TINYINT: confirm nullability and that bool-mapped TINYINT(1) is selected via the entity\nSELECT COLUMN_TYPE, IS_NULLABLE FROM information_schema.COLUMNS\nWHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND COLUMN_NAME = ?;","typeGuard":"fn is_i8_compatible(col_type: &str, nullable: bool, value_is_null: bool) -> bool {\n    col_type.eq_ignore_ascii_case(\"tinyint\") && !nullable && !value_is_null\n}","tryCatchPattern":null,"preventionTips":["Use Option<i8> or Option<bool> for nullable TINYINT columns","Select TINYINT(1) booleans through entity fields so SeaORM maps bool correctly","Keep mock proxy values as i8 for TINYINT columns","Avoid raw SQL for boolean-ish columns"],"tags":["mysql","sqlx","decoding","tinyint"],"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"}