{"record":{"id":"bb3a15a6d505c0aa","repo":"SonarSource/sonarqube","slug":"unsupported-database-dialect","errorCode":null,"errorMessage":"Unsupported database dialect: ","messagePattern":"Unsupported database dialect: ","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v202605/CreateDashboardsTable.java","lineNumber":97,"sourceCode":"      .setTable(tableName)\n      .setName(DASHBOARDS_NAME_RESOURCE_IDX)\n      .addColumn(NAME)\n      .addColumn(RESOURCE_TYPE)\n      .addColumn(RESOURCE_ID)\n      .build());\n  }\n\n  private void addTimestampDefaults(Context context, String tableName) {\n    switch (getDialect().getId()) {\n      case H2.ID, PostgreSql.ID -> context.execute(\n        ALTER_COLUMN_DEFAULT_TEMPLATE.formatted(tableName, CREATED_AT),\n        ALTER_COLUMN_DEFAULT_TEMPLATE.formatted(tableName, UPDATED_AT));\n      case MsSql.ID -> context.execute(\n        ADD_DEFAULT_CONSTRAINT_TEMPLATE.formatted(tableName, CREATED_AT_DEFAULT_CONSTRAINT, CREATED_AT),\n        ADD_DEFAULT_CONSTRAINT_TEMPLATE.formatted(tableName, UPDATED_AT_DEFAULT_CONSTRAINT, UPDATED_AT));\n      case Oracle.ID -> context.execute(\n        MODIFY_COLUMNS_DEFAULT_TEMPLATE.formatted(tableName, CREATED_AT, UPDATED_AT));\n      default -> throw new IllegalStateException(\"Unsupported database dialect: \" + getDialect().getId());\n    }\n  }\n}\n","sourceCodeStart":79,"sourceCodeEnd":101,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v202605/CreateDashboardsTable.java#L79-L101","documentation":"CreateDashboardsTable (v202605) adds CREATED_AT/UPDATED_AT timestamp defaults with per-dialect ALTER TABLE templates (H2/PostgreSQL, MsSql ADD CONSTRAINT, Oracle MODIFY). Unsupported dialect ids throw IllegalStateException \"Unsupported database dialect: <id>\" in addTimestampDefaults, called from the migration's execute.","triggerScenarios":"Executing the v202605.0 CreateDashboardsTable migration against a Dialect id not in the supported set (h2/postgresql, mssql, oracle).","commonSituations":"Running a bleeding-edge SonarQube build against an unsupported or experimental database; custom Dialect plugin; misconfigured dialect property.","solutions":["Run this SonarQube version only on a supported database (PostgreSQL, MS SQL, Oracle; H2 for eval).","If a new dialect must work, add a case with the correct ALTER TABLE ... SET DEFAULT syntax and update all DEFAULT-constraint constants.","Verify sonar.jdbc.dialect auto-detection isn't being overridden by a wrong explicit value."],"exampleFix":"// before\ndefault -> throw new IllegalStateException(\"Unsupported database dialect: \" + getDialect().getId());\n// after\ncase MySql.ID -> context.execute(ALTER_COLUMN_DEFAULT_TEMPLATE.formatted(tableName, CREATED_AT));\ndefault -> throw new IllegalStateException(\"Unsupported database dialect: \" + getDialect().getId());","handlingStrategy":"validation","validationCode":"String id = getDialect().getId();\nif (!Set.of(H2.ID, PostgreSql.ID, MsSql.ID, Oracle.ID).contains(id)) {\n  throw new IllegalArgumentException(\"Timestamp defaults unsupported for \" + id);\n}","typeGuard":"boolean supportsTimestampDefaults(Dialect d) { return Set.of(H2.ID, PostgreSql.ID, MsSql.ID, Oracle.ID).contains(d.getId()); }","tryCatchPattern":"try {\n  migration.execute(context);\n} catch (IllegalStateException e) {\n  LOG.error(\"Dashboards table migration failed: {}\", e.getMessage());\n  throw e;\n}","preventionTips":["Set explicit DEFAULT-constraint names per engine (MsSql named constraints) to keep drop/re-add idempotent.","Don't upgrade SonarQube before confirming the target DB engine is supported for the new version.","Keep a checklist of per-dialect templates when adding new migration steps."],"tags":["database","migration","unsupported-dialect","ddl"],"backgroundTag":"unsupported-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"}