Environment
SonarQube Version: 25.11.0.114957-community
Database: Azure SQL Database (Elastic Pool)
Database Collation: SQL_Latin1_General_CP1_CS_AS (case-sensitive)
Server Collation: SQL_Latin1_General_CP1_CI_AS (case-insensitive)
Previous Version: 24.12.0.100206-community (migration from 24.12 → 25.11)
Description
Database migration from SonarQube 24.12 to 25.11 fails on Azure SQL due to a collation conflict. The migration step #202501003 “Create index on ‘rule_tags’ table” fails because Azure SQL’s system catalog views and tempdb use the server’s default collation (CI_AS), which conflicts with the database’s CS_AS collation when performing UNION ALL operations.
Error Message
Execution of migration step #202501003 ‘Create index on ‘rule_tags’ table’ failed
Caused by: java.lang.IllegalStateException: Can not check that table rule_tags exists
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot resolve collation conflict between “SQL_Latin1_General_CP1_CI_AS” and “SQL_Latin1_General_CP1_CS_AS” in UNION ALL operator occurring in ORDER BY statement column 3.
Stack Trace
org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #202501003 ‘Create index on ‘rule_tags’ table’ failed
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration
Caused by: java.lang.IllegalStateException: Can not check that table rule_tags exists
at org.sonar.db.DatabaseUtils.wrapSqlException(DatabaseUtils.java:471)
at org.sonar.db.DatabaseUtils.getIndex(DatabaseUtils.java:374)
at org.sonar.db.DatabaseUtils.findIndex(DatabaseUtils.java:361)
at org.sonar.db.DatabaseUtils.indexExistsIgnoreCase(DatabaseUtils.java:320)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot resolve collation conflict between “SQL_Latin1_General_CP1_CI_AS” and “SQL_Latin1_General_CP1_CS_AS” in UNION ALL operator occurring in ORDER BY statement column 3.
at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getIndexInfo
Root Cause
On Azure SQL, the server collation is set at creation time and cannot be changed. The tempdb and system catalog views inherit the server’s collation. When SonarQube’s DatabaseUtils.getIndex() method queries system views with UNION ALL operations, SQL Server cannot resolve the collation mismatch between:
Server/tempdb: SQL_Latin1_General_CP1_CI_AS
Database tables: SQL_Latin1_General_CP1_CS_AS
Steps to Reproduce
Create an Azure SQL Server (default collation is CI_AS)
Create a database with CS_AS collation for SonarQube
Install SonarQube 24.12 and complete migration successfully
Upgrade to SonarQube 25.11
Run database migration from /setup
Migration fails at step #202501003
Expected Behavior
Migration should complete successfully or provide a workaround for Azure SQL environments where server collation cannot be changed.