apache/seatunnel · error · SeaTunnelException

Error to discover tables: ${e.getMessage()}

Error message

Error to discover tables: ${e.getMessage()}

What it means

PostgresDialect.discoverDataCollections lists tables matching the configured table filters via JDBC and validates capture settings. Any SQLException is wrapped in SeaTunnelException('Error to discover tables: ...'). It signals the table-discovery SQL against the source database failed.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/PostgresDialect.java:122

                "postgres-dialect");
    }

    @Override
    public ChunkSplitter createChunkSplitter(JdbcSourceConfig sourceConfig) {
        return new PostgresChunkSplitter(sourceConfig, this);
    }

    @Override
    public List<TableId> discoverDataCollections(JdbcSourceConfig sourceConfig) {
        PostgresSourceConfig postgresSourceConfig = (PostgresSourceConfig) sourceConfig;
        try (JdbcConnection jdbcConnection = openJdbcConnection(sourceConfig)) {
            List<TableId> tables =
                    TableDiscoveryUtils.listTables(
                            jdbcConnection, postgresSourceConfig.getTableFilters());
            this.checkAllTablesEnabledCapture(jdbcConnection, tables);
            return tables;
        } catch (SQLException e) {
            throw new SeaTunnelException("Error to discover tables: " + e.getMessage(), e);
        }
    }

    @Override
    public void checkAllTablesEnabledCapture(JdbcConnection jdbcConnection, List<TableId> tableIds)
            throws SQLException {
        PostgresConnection postgresConnection = (PostgresConnection) jdbcConnection;
        for (TableId tableId : tableIds) {
            ServerInfo.ReplicaIdentity replicaIdentity =
                    postgresConnection.readReplicaIdentityInfo(tableId);
            if (requireReplicaIdentityFull
                    && !ServerInfo.ReplicaIdentity.FULL.equals(replicaIdentity)) {
                throw new SeaTunnelException(
                        String.format(
                                "Table %s does not have a full replica identity, please execute: ALTER TABLE %s REPLICA IDENTITY FULL;",
                                tableId, tableId));
            }
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the wrapped e.getMessage() in the exception for the underlying SQL error.
  2. Verify connectivity and credentials (psql test with the same user/host).
  3. Grant the user SELECT permission on the target schema and pg catalog tables.
  4. Check the table pattern/filters resolve to existing tables in the configured database.
Defensive patterns

Strategy: retry

Validate before calling

psql "postgres://user@host:5432/mydb" -c "SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema='public';"

Try / catch

try {
  startCdcSource(cfg);
} catch (SeaTunnelException e) {
  if (e.getMessage().startsWith("Error to discover tables")) {
    // check e.getCause() SQLException: connectivity/permission; retry
  }
}

Prevention

When it happens

Trigger: Thrown from discoverDataCollections during source setup when TableDiscoveryUtils.listTables or readReplicaIdentityInfo JDBC calls throw SQLException (called by discoverTables).

Common situations: Database unreachable at startup; user lacks SELECT on the schema/catalog; invalid database name; connection timeout; SSL configuration mismatch.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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