{"record":{"id":"104833deb1384a9d","repo":"SeaQL/sea-orm","slug":"not-implemented-104833","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/database/statement.rs","lineNumber":112,"sourceCode":"        }\n    }\n}\n\nmacro_rules! build_any_stmt {\n    ($stmt: expr, $db_backend: expr) => {\n        match $db_backend {\n            DbBackend::MySql => $stmt.build(MysqlQueryBuilder),\n            DbBackend::Postgres => $stmt.build(PostgresQueryBuilder),\n            DbBackend::Sqlite => $stmt.build(SqliteQueryBuilder),\n        }\n    };\n}\n\nmacro_rules! build_postgres_stmt {\n    ($stmt: expr, $db_backend: expr) => {\n        match $db_backend {\n            DbBackend::Postgres => $stmt.to_string(PostgresQueryBuilder),\n            DbBackend::MySql | DbBackend::Sqlite => unimplemented!(),\n        }\n    };\n}\n\nmacro_rules! build_query_stmt {\n    ($stmt: ty) => {\n        impl StatementBuilder for $stmt {\n            fn build(&self, db_backend: &DbBackend) -> Statement {\n                let stmt = build_any_stmt!(self, db_backend);\n                Statement::from_string_values_tuple(*db_backend, stmt)\n            }\n\n            #[cfg(feature = \"rbac\")]\n            fn audit(&self) -> Result<QueryAccessAudit, AuditError> {\n                AuditTrait::audit(self)\n            }\n        }\n    };","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/database/statement.rs#L94-L130","documentation":"build_postgres_stmt! builds the statement only when the backend is Postgres; for MySql or Sqlite it calls unimplemented!() as a hard guard. The panic means a Postgres-only query/feature (e.g. PostgreSQL-specific SQL construction like returning clauses or locks) was sent through this helper against a non-Postgres backend. The at-fault input is a DbBackend::MySql/Sqlite backend reaching a Postgres-specific statement builder.","triggerScenarios":"Calling build/to_string on a statement type registered with build_postgres_stmt! while the target backend is MySql or Sqlite in the synchronous crate.","commonSituations":"Sync apps using Postgres-specific statements against MySQL/SQLite; portable code paths that do not gate on DbBackend.","solutions":["Only invoke the Postgres-specific statement builder when DbBackend is Postgres; branch on backend beforehand.","Use build_any_stmt! or the generic query builder path for MySQL/SQLite support.","If the feature is genuinely Postgres-only, gate the calling code path on the sqlx-postgres feature/backend so other backends never reach it."],"exampleFix":"// before\nlet sql = pg_only_stmt.to_string(&db_backend)?;\n// after\nif db_backend != DbBackend::Postgres { return Err(UnsupportedBackend(db_backend)); }\nlet sql = pg_only_stmt.to_string(PostgresQueryBuilder);","handlingStrategy":"validation","validationCode":"fn backend_supported(b: &sea_orm::DbBackend) -> bool {\n    matches!(b, sea_orm::DbBackend::Postgres)\n}","typeGuard":"fn is_postgres(b: &sea_orm::DbBackend) -> bool { matches!(b, sea_orm::DbBackend::Postgres) }","tryCatchPattern":"// guard before building\nif !is_postgres(&backend) { return Err(MyError::UnsupportedBackend(backend.clone())); }","preventionTips":["Gate sync statement builders on DbBackend::Postgres","Provide portable statement alternatives for MySQL/SQLite","Test statement building per backend in CI"],"tags":["panic","unimplemented","postgres","sync","backend"],"backgroundTag":"unsupported-platform","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"}