apache/seatunnel · error · CatalogException
Failed creating table %s
Error message
Failed creating table %s
What it means
PostgresCatalog.createTableInternal wraps all failures of executing the generated CREATE TABLE (and any CREATE INDEX) statements into CatalogException("Failed creating table %s"). The message names the target table; the actual SQL/connectivity error is the chained cause.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/psql/PostgresCatalog.java:191
String createTableSql = postgresCreateTableSqlBuilder.build(tablePath);
executeInternal(dbUrl, createTableSql);
if (postgresCreateTableSqlBuilder.isHaveConstraintKey) {
String alterTableSql =
"ALTER TABLE "
+ tablePath.getSchemaAndTableName("\"")
+ " REPLICA IDENTITY FULL;";
executeInternal(dbUrl, alterTableSql);
}
if (CollectionUtils.isNotEmpty(postgresCreateTableSqlBuilder.getCreateIndexSqls())) {
for (String createIndexSql : postgresCreateTableSqlBuilder.getCreateIndexSqls()) {
executeInternal(dbUrl, createIndexSql);
}
}
} catch (Exception ex) {
throw new CatalogException(
String.format("Failed creating table %s", tablePath.getFullName()), ex);
}
}
@Override
protected String getCreateTableSql(
TablePath tablePath, CatalogTable table, boolean createIndex) {
PostgresCreateTableSqlBuilder postgresCreateTableSqlBuilder =
new PostgresCreateTableSqlBuilder(table, createIndex);
return postgresCreateTableSqlBuilder.build(tablePath);
}
@Override
protected String getDropTableSql(TablePath tablePath) {
return "DROP TABLE \""
+ tablePath.getSchemaName()
+ "\".\""
+ tablePath.getTableName()View on GitHub (pinned to cf67b549a7)
Solutions
- Read the chained cause for the exact PostgreSQL error and failed statement
- Verify the target schema exists and the user has CREATE privilege
- Drop the pre-existing table or enable ignoreIfExists/drop-first
- Fix unsupported column types in the SeaTunnel catalog schema before createTable
Example fix
// before
catalog.createTable(path, table, false); // CatalogException: Failed creating table
// after
try {
catalog.createTable(path, table, false);
} catch (CatalogException e) {
log.error("DDL failed for {}: {}", path.getFullName(), e.getCause());
} Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check privileges and existence boolean schemaExists = /* SELECT 1 FROM information_schema.schemata WHERE schema_name = ? */; boolean tableFree = !catalog.tableExists(tablePath);
Try / catch
try { catalog.createTable(path, table, false); } catch (CatalogException e) { log.error("createTable {} failed: {}", path.getFullName(), e.getCause()); } Prevention
- Verify PG column type mapping for all source types before DDL execution
- Ensure target schema exists and user has CREATE privilege
- Enable ignoreIfExists or drop existing tables to avoid duplicate-table DDL failures
When it happens
Trigger: createTable on PostgresCatalog reaching DDL execution when the CREATE TABLE SQL is rejected — e.g. type mapping producing an unsupported PG type, reserved identifiers, existing table, or index creation failure via postgresCreateTableSqlBuilder.getCreateIndexSqls().
Common situations: Unsupported source-to-Postgres type mappings, schema name not existing in the database, insufficient CREATE privilege, duplicate table, invalid index column configuration.
Related errors
- Snapshotting of table ${table.id()} failed
- Failed to read schema for table ${tableId}
- Failed to build the split data read statement.
- Failed to alter table add column, SQL:
- Skipping unsupported default value for column {} in table {}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/8adc610f129fd263.
Report an issue: GitHub.