SonarSource/sonarqube · error · java.lang.IllegalArgumentException
Unsupported dialect id
Error message
Unsupported dialect id
What it means
RenameColumnsBuilder.build() generates ALTER TABLE ... RENAME COLUMN statements per dialect (H2, Oracle/PostgreSQL, MsSql sp_rename). An unrecognized dialect id throws IllegalArgumentException "Unsupported dialect id <id>". Note this one throws IllegalArgumentException rather than IllegalStateException.
Source
Thrown at server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilder.java:80
validateColumnName(r.getOldColumnName());
validateColumnName(r.getNewColumnName());
checkArgument(!r.getNewColumnName().equals(r.getOldColumnName()), "Column names must be different");
});
return createSqlStatement();
}
private List<String> createSqlStatement() {
return renamings.stream().map(
r -> {
switch (dialect.getId()) {
case H2.ID:
return "ALTER TABLE " + tableName + " ALTER COLUMN " + r.getOldColumnName() + " RENAME TO " + r.getNewColumnName();
case Oracle.ID, PostgreSql.ID:
return "ALTER TABLE " + tableName + " RENAME COLUMN " + r.getOldColumnName() + " TO " + r.getNewColumnName();
case MsSql.ID:
return "EXEC sp_rename '" + tableName + "." + r.getOldColumnName() + "', '" + r.getNewColumnName() + "', 'COLUMN'";
default:
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
}
}).toList();
}
private static class Renaming implements ColumnDef {
private final ColumnDef columnDef;
private final String oldColumnName;
private Renaming(String oldColumnName, ColumnDef columnDef) {
this.columnDef = columnDef;
this.oldColumnName = oldColumnName;
}
public String getOldColumnName() {
return oldColumnName;
}
public String getNewColumnName() {View on GitHub (pinned to 184c821202)
Solutions
- Confirm the deployment uses a supported database (H2 only for eval, PostgreSQL, Oracle, or MS SQL).
- If a new dialect must be supported, add a case to RenameColumnsBuilder's switch with the proper RENAME syntax.
- Search the codebase for other switch-on-dialect builders missed when the dialect was introduced.
Example fix
// before
default:
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
// after
case MySql.ID:
return "RENAME TABLE " + tableName + " TO " + tableName + "_tmp";
default:
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId()); Defensive patterns
Strategy: validation
Validate before calling
if (!Set.of(H2.ID, Oracle.ID, PostgreSql.ID, MsSql.ID).contains(dialect.getId())) {
throw new IllegalArgumentException("Rename column unsupported for " + dialect.getId());
} Type guard
boolean supportsRenameColumn(Dialect d) { return Set.of(H2.ID, Oracle.ID, PostgreSql.ID, MsSql.ID).contains(d.getId()); } Try / catch
try {
sqls = new RenameColumnsBuilder(dialect).renameColumn(table, oldName, newName).build();
} catch (IllegalArgumentException e) {
LOG.error("Column rename skipped: {}", e.getMessage());
} Prevention
- Confirm the target engine supports the rename syntax your migration emits.
- Cover all dialect ids in RenameColumnsBuilder unit tests.
- Run the migration dry-run/verification on a staging DB of the same engine type.
When it happens
Trigger: Executing a column-rename migration step (RenameColumnsBuilder.build) against a Dialect whose id is not h2, oracle, postgresql, or mssql.
Common situations: Unsupported or experimental database backends; new dialect added to the platform but this builder not extended; misconfigured dialect id in sonar.properties.
Related errors
- Unsupported dialect for drop of constraint:
- Unsupported database '%s'
- Unsupported DB:
- Unsupported dialect id
- Unsupported dialect for drop of index:
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/396d38bc233aa5cc.
Report an issue: GitHub.