apache/beam · warning

Wrong JDBC type. Expected '{}' but got '{}'. Overriding with

Error message

Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.

What it means

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.

Source

Thrown at sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromPostgresSchemaTransformProvider.java:62

    return getUrn(ExternalTransforms.ManagedTransforms.Urns.POSTGRES_READ);
  }

  @Override
  public String description() {
    return inheritedDescription("Postgres", "ReadFromPostgres", "postgresql", 5432);
  }

  @Override
  protected String jdbcType() {
    return POSTGRES;
  }

  @Override
  public @UnknownKeyFor @NonNull @Initialized SchemaTransform from(
      JdbcReadSchemaTransformConfiguration configuration) {
    String jdbcType = configuration.getJdbcType();
    if (jdbcType != null && !jdbcType.isEmpty() && !jdbcType.equals(jdbcType())) {
      LOG.warn(
          "Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.",
          jdbcType(),
          jdbcType,
          jdbcType());
      configuration = configuration.toBuilder().setJdbcType(jdbcType()).build();
    }

    List<@org.checkerframework.checker.nullness.qual.Nullable String> connectionInitSql =
        configuration.getConnectionInitSql();
    if (connectionInitSql != null && !connectionInitSql.isEmpty()) {
      throw new IllegalArgumentException("Postgres does not support connectionInitSql.");
    }

    Boolean disableAutoCommit = configuration.getDisableAutoCommit();
    if (disableAutoCommit != null && !disableAutoCommit) {
      LOG.warn("Postgres reads require disableAutoCommit to be true, overriding to true.");
    }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Remove the jdbcType field from JdbcReadSchemaTransformConfiguration so the Postgres default is used.
  2. Set jdbcType to the exact value returned by the provider's jdbcType() (Postgres) via configuration.toBuilder().setJdbcType(...).build().
  3. Use the correct provider class for the intended database (e.g. ReadFromMySqlSchemaTransformProvider) if Postgres is not the target.
  4. Verify with the provider documentation which jdbcType strings are accepted.

Example fix

// before
JdbcReadSchemaTransformConfiguration cfg = JdbcReadSchemaTransformConfiguration.builder()
    .setJdbcType("mysql")
    .setUrl("jdbc:postgresql://host/db")
    .build();
// after
JdbcReadSchemaTransformConfiguration cfg = JdbcReadSchemaTransformConfiguration.builder()
    .setUrl("jdbc:postgresql://host/db")
    .build();
Defensive patterns

Strategy: validation

Validate before calling

if (config.getJdbcType() != null && !config.getJdbcType().isEmpty()
    && !"postgres".equalsIgnoreCase(config.getJdbcType())) {
  throw new IllegalArgumentException("jdbcType must be postgres for ReadFromPostgresSchemaTransformProvider");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/7e8d60ef0348fef8. Report an issue: GitHub.