apache/seatunnel · error · SeaTunnelRuntimeException

COMMON-19

COMMON-19

Error message

'${identifier}' unsupported convert SeaTunnel data type '${dataType}' of '${field}' to connector data type.

What it means

PostgresTypeConverter.reconvert() throws this when reverse-mapping a SeaTunnel ARRAY column to a Postgres array type and the array's ELEMENT type is unsupported (inner default). CommonError.convertToConnectorTypeError is raised with DatabaseIdentifier.POSTGRESQL and the element SQL type name.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresTypeConverter.java:513

                        break;
                    case FLOAT:
                        builder.columnType(PG_REAL_ARRAY);
                        builder.dataType(PG_REAL_ARRAY);
                        break;
                    case DOUBLE:
                        builder.columnType(PG_DOUBLE_PRECISION_ARRAY);
                        builder.dataType(PG_DOUBLE_PRECISION_ARRAY);
                        break;
                    case BYTES:
                        builder.columnType(PG_BYTEA);
                        builder.dataType(PG_BYTEA);
                        break;
                    case STRING:
                        builder.columnType(PG_TEXT_ARRAY);
                        builder.dataType(PG_TEXT_ARRAY);
                        break;
                    default:
                        throw CommonError.convertToConnectorTypeError(
                                DatabaseIdentifier.POSTGRESQL,
                                elementType.getSqlType().name(),
                                column.getName());
                }
                break;
            default:
                throw CommonError.convertToConnectorTypeError(
                        DatabaseIdentifier.POSTGRESQL,
                        column.getDataType().getSqlType().name(),
                        column.getName());
        }

        return builder.build();
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Pre-create the PG table with a matching text[]/jsonb column and disable auto-create-table
  2. Cast the array element to a supported type (e.g. ARRAY<STRING>) via a transform
  3. Extend the inner switch in PostgresTypeConverter.reconvert

Example fix

// before: ARRAY<MAP> auto-create fails
// after: transform MAP column to JSON string first
// transform { Json {} } then sink ARRAY<STRING>/STRING column
Defensive patterns

Strategy: validation

Validate before calling

// Verify PG array element types before auto-create:
for (CatalogColumn col : schema.getColumns()) {
    if (col.getDataType() instanceof ArrayType) {
    SqlType el = ((ArrayType) col.getDataType()).getElementType().getSqlType();
    if (!(el == SqlType.STRING || el == SqlType.INT || el == SqlType.BIGINT || el == SqlType.DOUBLE || el == SqlType.BOOLEAN)) {
        throw new IllegalStateException("Unsupported PG array element: " + el);
    }
    }
}

Try / catch

try {
    PhysicalColumn col = converter.reconvert(column);
} catch (SeaTunnelRuntimeException e) {
    LOG.warn("Cannot map PG array element: {}", e.getMessage());
    // fallback: map element to STRING (text[])
}

Prevention

When it happens

Trigger: Auto-creating a Postgres table for a sink where a SeaTunnel ARRAY column has an element type not mapped to a PG array element (e.g. ARRAY<MAP>, ARRAY<ROW>, ARRAY<NULL>) — inner default in reconvert.

Common situations: Sinking JSON/complex sources into Postgres with auto-create-table enabled; PG arrays exist only for primitive element types, so nested/complex elements fail reconvert.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/0a058ec30d79bcdb. Report an issue: GitHub.