{"record":{"id":"1c999f6efd59ce0c","repo":"apache/seatunnel","slug":"can-t-create-jdbcdialect-without-compatible-mode-f","errorCode":null,"errorMessage":"Can't create JdbcDialect without compatible mode for Dsql","messagePattern":"Can't create JdbcDialect without compatible mode for Dsql","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/dsql/DsqlDialectFactory.java","lineNumber":47,"sourceCode":"\n@AutoService(JdbcDialectFactory.class)\npublic class DsqlDialectFactory implements JdbcDialectFactory {\n\n    private static final Pattern DSQL_PATTERN = Pattern.compile(\".*dsql\\\\.[a-z0-9-]+\\\\.on\\\\.aws.*\");\n\n    @Override\n    public String dialectFactoryName() {\n        return DatabaseIdentifier.DSQL;\n    }\n\n    @Override\n    public boolean acceptsURL(String url) {\n        return url.startsWith(\"jdbc:postgresql:\") && containsDsql(url);\n    }\n\n    @Override\n    public JdbcDialect create() {\n        throw new UnsupportedOperationException(\n                \"Can't create JdbcDialect without compatible mode for Dsql\");\n    }\n\n    @Override\n    public JdbcDialect create(@Nonnull String compatibleMode, String fieldIde) {\n\n        return new DsqlDialect(fieldIde);\n    }\n\n    private boolean containsDsql(String url) {\n        return DSQL_PATTERN.matcher(url).matches();\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":61,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dsql/DsqlDialectFactory.java#L29-L61","documentation":"DsqlDialectFactory.create() unconditionally throws UnsupportedOperationException because the Dsql dialect cannot be instantiated without a compatible mode. Callers must use the two-argument create(compatibleMode, fieldIde) overload instead.","triggerScenarios":"Code path resolves a JdbcDialectFactory by URL (jdbc:postgresql:... containing a Dsql marker) and invokes the no-arg create() factory method.","commonSituations":"Misconfigured pipeline that selects the Dsql dialect but does not propagate a compatible mode; older plugin code or config that omits the compatible_mode setting for Dsql URLs.","solutions":["Configure a compatible mode so the factory's create(compatibleMode, fieldIde) path is used.","If you do not need Dsql, use a standard PostgreSQL JDBC URL so the regular Postgres dialect factory is selected.","Update connector/plugin code to never call the no-arg create() for Dsql URLs."],"exampleFix":"// before\nJdbcDialect dialect = factory.create();\n// after\nJdbcDialect dialect = factory.create(compatibleMode, fieldIde);","handlingStrategy":"type-guard","validationCode":"if (factory instanceof DsqlDialectFactory && compatibleMode == null) { throw new IllegalStateException(\"Dsql requires compatible_mode\"); }","typeGuard":"JdbcDialect safeCreate(JdbcDialectFactory f, String mode, String fieldIde) { return f instanceof DsqlDialectFactory ? f.create(mode, fieldIde) : f.create(); }","tryCatchPattern":"try { dialect = factory.create(); } catch (UnsupportedOperationException e) { dialect = factory.create(compatibleMode, fieldIde); }","preventionTips":["Always set compatible_mode for Dsql URLs","Never call the no-arg create() on DsqlDialectFactory","Test dialect resolution early with a connection smoke test"],"tags":["jdbc","dsql","dialect-factory"],"backgroundTag":"missing-required-config-field","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"}