SeaQL/sea-orm · error
not implemented
Error message
not implemented
What it means
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.
Source
Thrown at sea-orm-sync/src/database/statement.rs:112
}
}
}
macro_rules! build_any_stmt {
($stmt: expr, $db_backend: expr) => {
match $db_backend {
DbBackend::MySql => $stmt.build(MysqlQueryBuilder),
DbBackend::Postgres => $stmt.build(PostgresQueryBuilder),
DbBackend::Sqlite => $stmt.build(SqliteQueryBuilder),
}
};
}
macro_rules! build_postgres_stmt {
($stmt: expr, $db_backend: expr) => {
match $db_backend {
DbBackend::Postgres => $stmt.to_string(PostgresQueryBuilder),
DbBackend::MySql | DbBackend::Sqlite => unimplemented!(),
}
};
}
macro_rules! build_query_stmt {
($stmt: ty) => {
impl StatementBuilder for $stmt {
fn build(&self, db_backend: &DbBackend) -> Statement {
let stmt = build_any_stmt!(self, db_backend);
Statement::from_string_values_tuple(*db_backend, stmt)
}
#[cfg(feature = "rbac")]
fn audit(&self) -> Result<QueryAccessAudit, AuditError> {
AuditTrait::audit(self)
}
}
};View on GitHub (pinned to e29bcd1b41)
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.
Example fix
// before
let sql = pg_only_stmt.to_string(&db_backend)?;
// after
if db_backend != DbBackend::Postgres { return Err(UnsupportedBackend(db_backend)); }
let sql = pg_only_stmt.to_string(PostgresQueryBuilder); Defensive patterns
Strategy: validation
Validate before calling
fn backend_supported(b: &sea_orm::DbBackend) -> bool {
matches!(b, sea_orm::DbBackend::Postgres)
} Type guard
fn is_postgres(b: &sea_orm::DbBackend) -> bool { matches!(b, sea_orm::DbBackend::Postgres) } Try / catch
// guard before building
if !is_postgres(&backend) { return Err(MyError::UnsupportedBackend(backend.clone())); } Prevention
- Gate sync statement builders on DbBackend::Postgres
- Provide portable statement alternatives for MySQL/SQLite
- Test statement building per backend in CI
When it happens
Trigger: 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.
Common situations: Sync apps using Postgres-specific statements against MySQL/SQLite; portable code paths that do not gate on DbBackend.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- not implemented
- Audit not supported for {} yet
- Not Postgres Connection
- Not Postgres Connection
- Audit not supported for {} yet
AI-assisted analysis of SeaQL/sea-orm@e29bcd1b41 (2026-09-10).
Data as JSON: /api/errors/104833deb1384a9d.
Report an issue: GitHub.