apache/seatunnel · error · UnsupportedOperationException
Can't create JdbcDialect without compatible mode for…
Error message
Can't create JdbcDialect without compatible mode for Postgres
What it means
PostgresDialectFactory.create() without arguments is not supported for Postgres: the dialect requires a compatible mode to be selected. Callers must use the create(compatibleMode, fieldIde) overload instead; the no-arg version unconditionally throws UnsupportedOperationException.
Solutions
- Pass compatible_mode (e.g. 'postgres' or 'postgresLow') so create(compatibleMode, fieldIde) is invoked
- Ensure your dialect-resolution path forwards the connector's compatible_mode option instead of calling create()
- Use the URL-based factory resolution that supports Postgres parameters
Example fix
// before JdbcDialect d = factory.create(); // after JdbcDialect d = factory.create(compatibleMode, fieldIde); // compatibleMode from config
Defensive patterns
Strategy: type-guard
Validate before calling
if (compatibleMode == null) {
throw new IllegalArgumentException("compatible_mode is required for postgres dialect");
} Type guard
boolean canCreateNoArg = !(factory instanceof PostgresDialectFactory);
Try / catch
try { return factory.create(); } catch (UnsupportedOperationException e) { return factory.create(compatibleMode, fieldIde); } Prevention
- Always set compatible_mode for postgres URLs
- Route dialect creation through the overload that takes compatibleMode
- Audit generic dialect-resolution code paths that call create()
When it happens
Trigger: Invoking JdbcDialectFactory.create() (the no-arg overload) for the postgres dialect, e.g. via generic dialect resolution that ignores compatible mode.
Common situations: Framework code resolving a dialect by URL only ('jdbc:postgresql:...') without passing the compatible_mode config; custom tooling built on the factory API.
Related errors
- Can't create JdbcDialect without compatible mode for Dsql
- Can't create JdbcDialect without compatible mode for Hive
- CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE
- Couldn't get timestamp utils from underlying connection
- Couldn't obtain encoding for database
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/5ebd8534c132a0d2.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresDialectFactory.java:43
import com.google.auto.service.AutoService;
import javax.annotation.Nonnull;
@AutoService(JdbcDialectFactory.class)
public class PostgresDialectFactory implements JdbcDialectFactory {
@Override
public String dialectFactoryName() {
return DatabaseIdentifier.POSTGRESQL;
}
@Override
public boolean acceptsURL(String url) {
return url.startsWith("jdbc:postgresql:");
}
@Override
public JdbcDialect create() {
throw new UnsupportedOperationException(
"Can't create JdbcDialect without compatible mode for Postgres");
}
@Override
public JdbcDialect create(@Nonnull String compatibleMode, String fieldIde) {
if ("postgresLow".equalsIgnoreCase(compatibleMode)) {
return new PostgresLowDialect(fieldIde);
}
return new PostgresDialect(fieldIde);
}
}
View on GitHub (pinned to cf67b549a7)