Skip to content

[Bug] PostgresTypeUtils crashes on numeric precision > 38 instead of falling back to STRING #8605

Description

@thswlsqls

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version
master @ ec1d8ee

Compute Engine
Flink (Postgres CDC — postgres_sync_table / postgres_sync_database)

Minimal reproduce step
Sync a Postgres table containing a numeric(50, 2) column (Postgres allows precision up to 1000).
PostgresTypeUtils.toDataType() (paimon-flink-cdc .../action/cdc/postgres/PostgresTypeUtils.java line 125-136) passes the JDBC COLUMN_SIZE precision straight into DataTypes.DECIMAL(precision, scale) with no upper-bound guard.

What doesn't meet your expectations?
Because Paimon DecimalType.MAX_PRECISION is 38, DataTypes.DECIMAL(50, 2) throws IllegalArgumentException("Decimal precision must be between 1 and 38"), so schema derivation fails and the whole CDC sink never starts. The sibling MySqlTypeUtils.toDataType() (line 259-261, same JdbcToPaimonTypeVisitor SPI) already guards this with length <= 38 ? DECIMAL : STRING; Postgres should behave the same and fall back to STRING (ARRAY(STRING) for _numeric).

Anything else?
N/A

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions