SonarSource/sonarqube · error · java.lang.IllegalArgumentException
Unsupported dialect id
Error message
Unsupported dialect id
What it means
RenameTableBuilder.build() emits dialect-specific table rename SQL (including Oracle trigger/sequence handling for auto-generated ids). Any dialect id other than the supported ones throws IllegalArgumentException "Unsupported dialect id <id>".
Source
Thrown at server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/RenameTableBuilder.java:88
checkArgument(!name.equals(newName), "Names must be different");
return createSqlStatement();
}
private List<String> createSqlStatement() {
switch (dialect.getId()) {
case H2.ID, PostgreSql.ID:
return singletonList("ALTER TABLE " + name + " RENAME TO " + newName);
case MsSql.ID:
return singletonList("EXEC sp_rename '" + name + "', '" + newName + "'");
case Oracle.ID:
String renameSqlCommand = "RENAME " + name + " TO " + newName;
return autoGeneratedId ? asList(
"DROP TRIGGER " + name + "_idt", renameSqlCommand,
"RENAME " + name + "_seq TO " + newName + "_seq",
CreateTableBuilder.createOracleTriggerForTable(newName))
: singletonList(renameSqlCommand);
default:
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
}
}
}
View on GitHub (pinned to 184c821202)
Solutions
- Use a database officially supported by your SonarQube version.
- Add the missing dialect case to RenameTableBuilder, matching its RENAME TABLE syntax.
- Align dialect registration: every new Dialect id must be handled in all sql builders (DropTableBuilder, RenameTableBuilder, etc.).
Example fix
// before
default:
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
// after
case PostgreSql.ID, MySql.ID:
return singletonList("RENAME TABLE " + name + " TO " + newName);
default:
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId()); Defensive patterns
Strategy: validation
Validate before calling
if (!Set.of(H2.ID, PostgreSql.ID, MsSql.ID, Oracle.ID).contains(dialect.getId())) {
throw new IllegalArgumentException("Table rename unsupported for " + dialect.getId());
} Type guard
boolean supportsRenameTable(Dialect d) { return Set.of(H2.ID, PostgreSql.ID, MsSql.ID, Oracle.ID).contains(d.getId()); } Try / catch
try {
sqls = new RenameTableBuilder(dialect).rename(name, newName).build();
} catch (IllegalArgumentException e) {
LOG.error("Table rename failed: {}", e.getMessage());
} Prevention
- Migrate data before switching to an unsupported/newer database engine.
- Handle Oracle's trigger/sequence companion objects when renaming auto-id tables.
- Keep dialect switch statements in sync across all *Builder classes.
When it happens
Trigger: Running a migration step that renames a table via RenameTableBuilder.createSqlStatement on a Dialect with an id outside the supported set (h2, postgresql, mssql, oracle).
Common situations: Deploying SonarQube on an unofficial database; a newly registered dialect whose SQL builders were not all updated; test stubs with arbitrary dialect ids.
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/d5670688c93211cc.
Report an issue: GitHub.