{"record":{"id":"97ac5174d107c40a","repo":"SonarSource/sonarqube","slug":"unsupported-database-s-97ac51","errorCode":null,"errorMessage":"Unsupported database '%s'","messagePattern":"Unsupported database '(.+?)'","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilder.java","lineNumber":66,"sourceCode":"    this.tableName = tableName;\n    this.dialect = dialect;\n    this.columns = columns;\n  }\n\n  public List<String> build() {\n    switch (dialect.getId()) {\n      case PostgreSql.ID:\n        StringBuilder sql = new StringBuilder().append(ALTER_TABLE).append(tableName).append(\" \");\n        dropColumns(sql, \"DROP COLUMN \", columns);\n        return Collections.singletonList(sql.toString());\n      case MsSql.ID:\n        return Collections.singletonList(getMsSQLStatement(columns));\n      case Oracle.ID:\n        return Collections.singletonList(getOracleStatement());\n      case H2.ID:\n        return Arrays.stream(columns).map(this::getMsSQLStatement).toList();\n      default:\n        throw new IllegalStateException(String.format(\"Unsupported database '%s'\", dialect.getId()));\n    }\n  }\n\n  private String getOracleStatement() {\n    StringBuilder sql = new StringBuilder().append(ALTER_TABLE).append(tableName).append(\" \");\n    sql.append(\"SET UNUSED (\");\n    dropColumns(sql, \"\", columns);\n    sql.append(\")\");\n    return sql.toString();\n  }\n\n  private String getMsSQLStatement(String... columnNames) {\n    StringBuilder sql = new StringBuilder().append(ALTER_TABLE).append(tableName).append(\" \");\n    sql.append(\"DROP COLUMN \");\n    dropColumns(sql, \"\", columnNames);\n    return sql.toString();\n  }\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilder.java#L48-L84","documentation":"Generic guard in DropColumnsBuilder.build(): the SQL builder only knows how to generate DROP COLUMN statements for the PostgreSQL, MsSql, Oracle and H2 dialects; any other configured database id reaches the switch default and aborts the migration with this error. The input at fault is the database dialect of the SonarQube instance being migrated, which is unsupported for this schema-change operation.","triggerScenarios":"Building a drop-columns migration with an unsupported/unknown dialect id.","commonSituations":"Unsupported database in sonar.jdbc dialect detection; custom dialect added to the app but not to DropColumnsBuilder; stale builder code after adding a new dialect.","solutions":["Run migrations against a supported database (PostgreSQL, MySQL, MsSql, Oracle, H2).","Fix the dialect id configuration.","Add a case for the new dialect in DropColumnsBuilder if it must be supported."],"exampleFix":"// before\ncase MyDialect.ID: // missing in switch -> default throws\n// after\nswitch (dialect.getId()) {\n  case PostgreSql.ID: ... case H2.ID: ... // add explicit supported cases\n}","handlingStrategy":"validation","validationCode":"if (!Set.of(PostgreSql.ID, MySql.ID, MsSql.ID, Oracle.ID, H2.ID).contains(dialect.getId())) { throw new IllegalStateException(\"unsupported dialect\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-check dialect id before any drop/add column builder usage","Keep all SQL builders' dialect switches in sync","Log the detected dialect during startup"],"tags":["database","dialect","unsupported","migration"],"backgroundTag":"invalid-enum-value","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}