SeaQL/sea-orm · error
not implemented
Error message
not implemented
What it means
build_postgres_stmt! in src/database/statement.rs only renders its statement with the Postgres query builder; for DbBackend::MySql or Sqlite it calls unimplemented!(). The statement types registered with this macro have no SQL rendering for those backends.
Source
Thrown at 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
- Use the statement only with a Postgres backend; check DbBackend before building
- Use a portable sea_query statement/builder variant for MySQL/SQLite
- Split backend-specific code paths so the wrong backend never reaches this statement
Example fix
// before let sql = pg_only_stmt.to_string(&db_backend)?; // panics on MySql/Sqlite // after assert_eq!(db_backend, DbBackend::Postgres); let sql = pg_only_stmt.to_string(PostgresQueryBuilder);
Defensive patterns
Strategy: validation
Validate before calling
use sea_orm::DbBackend;
fn backend_supported(b: &DbBackend) -> bool {
matches!(b, DbBackend::Postgres)
} Type guard
fn is_postgres(b: &DbBackend) -> bool { matches!(b, DbBackend::Postgres) } Try / catch
// unimplemented!() panics; check backend first
if is_postgres(&db_backend) { let sql = pg_only_stmt.to_string(&db_backend); } else { /* portable path */ } Prevention
- Check DbBackend before building backend-specific statements
- Keep Postgres-only statements in Postgres-only code paths
- Add debug_assert!(is_postgres(&backend)) near these builders
When it happens
Trigger: Building (calling .to_string()/build on) a statement whose type is compiled via build_postgres_stmt! while the connection backend is DbBackend::MySql or DbBackend::Sqlite.
Common situations: Using Postgres-only statement types while connected to MySQL or SQLite; sharing statement-building code across backends without a backend check.
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
- Not Postgres Connection
- Not Postgres Connection
- Audit not supported for {} yet
- Audit not supported for {} yet
AI-assisted analysis of SeaQL/sea-orm@e29bcd1b41 (2026-09-10).
Data as JSON: /api/errors/556c8a3781aac7ea.
Report an issue: GitHub.