{"record":{"id":"7e8d60ef0348fef8","repo":"apache/beam","slug":"wrong-jdbc-type-expected-but-got-overriding-with-7e8d60","errorCode":null,"errorMessage":"Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.","messagePattern":"Wrong JDBC type\\. Expected '(.+?)' but got '(.+?)'\\. Overriding with '(.+?)'\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromPostgresSchemaTransformProvider.java","lineNumber":62,"sourceCode":"    return getUrn(ExternalTransforms.ManagedTransforms.Urns.POSTGRES_READ);\n  }\n\n  @Override\n  public String description() {\n    return inheritedDescription(\"Postgres\", \"ReadFromPostgres\", \"postgresql\", 5432);\n  }\n\n  @Override\n  protected String jdbcType() {\n    return POSTGRES;\n  }\n\n  @Override\n  public @UnknownKeyFor @NonNull @Initialized SchemaTransform from(\n      JdbcReadSchemaTransformConfiguration configuration) {\n    String jdbcType = configuration.getJdbcType();\n    if (jdbcType != null && !jdbcType.isEmpty() && !jdbcType.equals(jdbcType())) {\n      LOG.warn(\n          \"Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.\",\n          jdbcType(),\n          jdbcType,\n          jdbcType());\n      configuration = configuration.toBuilder().setJdbcType(jdbcType()).build();\n    }\n\n    List<@org.checkerframework.checker.nullness.qual.Nullable String> connectionInitSql =\n        configuration.getConnectionInitSql();\n    if (connectionInitSql != null && !connectionInitSql.isEmpty()) {\n      throw new IllegalArgumentException(\"Postgres does not support connectionInitSql.\");\n    }\n\n    Boolean disableAutoCommit = configuration.getDisableAutoCommit();\n    if (disableAutoCommit != null && !disableAutoCommit) {\n      LOG.warn(\"Postgres reads require disableAutoCommit to be true, overriding to true.\");\n    }\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromPostgresSchemaTransformProvider.java#L44-L80","documentation":"This is a warning logged by the Postgres read SchemaTransform provider when the configuration's jdbcType does not match the provider's own type. The provider overrides the wrong value with its own jdbcType() and continues, so the pipeline runs against Postgres instead of whatever database was configured. It indicates a configuration/driver mismatch that was silently corrected.","triggerScenarios":"Building a ReadFromPostgresSchemaTransformProvider with a JdbcReadSchemaTransformConfiguration whose setJdbcType() is non-null, non-empty, and not equal to the provider's jdbcType() (e.g. \"mysql\" or a custom value) when from() is called.","commonSituations":"Copy-pasting a JDBC transform configuration between database providers, generating the config programmatically with a generic/default jdbcType, or switching the database behind a pipeline without updating the jdbcType field.","solutions":["Remove the jdbcType field from JdbcReadSchemaTransformConfiguration so the Postgres default is used.","Set jdbcType to the exact value returned by the provider's jdbcType() (Postgres) via configuration.toBuilder().setJdbcType(...).build().","Use the correct provider class for the intended database (e.g. ReadFromMySqlSchemaTransformProvider) if Postgres is not the target.","Verify with the provider documentation which jdbcType strings are accepted."],"exampleFix":"// before\nJdbcReadSchemaTransformConfiguration cfg = JdbcReadSchemaTransformConfiguration.builder()\n    .setJdbcType(\"mysql\")\n    .setUrl(\"jdbc:postgresql://host/db\")\n    .build();\n// after\nJdbcReadSchemaTransformConfiguration cfg = JdbcReadSchemaTransformConfiguration.builder()\n    .setUrl(\"jdbc:postgresql://host/db\")\n    .build();","handlingStrategy":"validation","validationCode":"if (config.getJdbcType() != null && !config.getJdbcType().isEmpty()\n    && !\"postgres\".equalsIgnoreCase(config.getJdbcType())) {\n  throw new IllegalArgumentException(\"jdbcType must be postgres for ReadFromPostgresSchemaTransformProvider\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not set jdbcType explicitly when using a database-specific provider.","Build configs with the provider for the target database, never share one config across providers.","Read the provider's jdbcType() in tests to assert the configured value matches."],"tags":["jdbc","postgres","configuration","beam-io"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}