{"record":{"id":"5ebd8534c132a0d2","repo":"apache/seatunnel","slug":"can-t-create-jdbcdialect-without-compatible-mode-f-5ebd85","errorCode":null,"errorMessage":"Can't create JdbcDialect without compatible mode for Postgres","messagePattern":"Can't create JdbcDialect without compatible mode for Postgres","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresDialectFactory.java","lineNumber":43,"sourceCode":"import com.google.auto.service.AutoService;\n\nimport javax.annotation.Nonnull;\n\n@AutoService(JdbcDialectFactory.class)\npublic class PostgresDialectFactory implements JdbcDialectFactory {\n    @Override\n    public String dialectFactoryName() {\n        return DatabaseIdentifier.POSTGRESQL;\n    }\n\n    @Override\n    public boolean acceptsURL(String url) {\n        return url.startsWith(\"jdbc:postgresql:\");\n    }\n\n    @Override\n    public JdbcDialect create() {\n        throw new UnsupportedOperationException(\n                \"Can't create JdbcDialect without compatible mode for Postgres\");\n    }\n\n    @Override\n    public JdbcDialect create(@Nonnull String compatibleMode, String fieldIde) {\n        if (\"postgresLow\".equalsIgnoreCase(compatibleMode)) {\n            return new PostgresLowDialect(fieldIde);\n        }\n        return new PostgresDialect(fieldIde);\n    }\n}\n","sourceCodeStart":25,"sourceCodeEnd":55,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresDialectFactory.java#L25-L55","documentation":"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.","triggerScenarios":"Invoking JdbcDialectFactory.create() (the no-arg overload) for the postgres dialect, e.g. via generic dialect resolution that ignores compatible mode.","commonSituations":"Framework code resolving a dialect by URL only ('jdbc:postgresql:...') without passing the compatible_mode config; custom tooling built on the factory API.","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"],"exampleFix":"// before\nJdbcDialect d = factory.create();\n// after\nJdbcDialect d = factory.create(compatibleMode, fieldIde); // compatibleMode from config","handlingStrategy":"type-guard","validationCode":"if (compatibleMode == null) {\n    throw new IllegalArgumentException(\"compatible_mode is required for postgres dialect\");\n}","typeGuard":"boolean canCreateNoArg = !(factory instanceof PostgresDialectFactory);","tryCatchPattern":"try { return factory.create(); } catch (UnsupportedOperationException e) { return factory.create(compatibleMode, fieldIde); }","preventionTips":["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()"],"tags":["jdbc","postgres","dialect-factory","unsupported-operation"],"backgroundTag":"method-not-implemented","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}