Postgres DB duplicate key Error by updating from Sonarqube 9.6 to 9.7

I am trying to update from sonarqube 9.6 to 9.7 via /setup.
The Server version is postgres 11.16.
The migration process fails and I get the following error message in the web.log:

org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #6608 'Remove branch information from 'kee' in 'components'' 
failed at  org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(
at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.base/java.util.concurrent.ThreadPoolExecutor$
at java.base/
Caused by: java.lang.IllegalStateException: Error during processing of row: [kee=<-1->:src/main/kotlin/com/<->/emma/<->/mqtt/LisaBackchannelCl
at org.sonar.server.platform.db.migration.step.SelectImpl.newExceptionWithRowDetails(
at org.sonar.server.platform.db.migration.step.SelectImpl.scroll(
at org.sonar.server.platform.db.migration.step.MassUpdate.execute(
at org.sonar.server.platform.db.migration.version.v97.RemoveBranchInformationFromComponentsKey.execute(
at org.sonar.server.platform.db.migration.step.DataChange.execute(
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(
... 9 common frames omitted
Caused by: java.sql.BatchUpdateException: Batch entry 0 update components set kee = '<-2->' where uuid= 'AYMRKAakenJfudp65unU' was aborted: E
RROR: duplicate key value violates unique constraint "idx_336156_projects_kee"
Detail: Key (kee)=(<-2->) already exists. Call getNextException to see other errors in the batch.
at org.postgresql.jdbc.BatchResultHandler.handleError(
at org.postgresql.core.v3.QueryExecutorImpl.processResults(
at org.postgresql.core.v3.QueryExecutorImpl.execute(
at org.postgresql.jdbc.PgStatement.internalExecuteBatch(
at org.postgresql.jdbc.PgStatement.executeBatch(
at org.postgresql.jdbc.PgPreparedStatement.executeBatch(
at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(
at org.sonar.server.platform.db.migration.step.UpsertImpl.addBatch(
at org.sonar.server.platform.db.migration.step.MassUpdate.callSingleHandler(
at org.sonar.server.platform.db.migration.step.MassUpdate.lambda$execute$0(
at org.sonar.server.platform.db.migration.step.SelectImpl.scroll(
... 13 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "idx_336156_projects_kee"
Detail: Key (kee)=(<-2->) already exists.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
at org.postgresql.core.v3.QueryExecutorImpl.processResults(
... 23 common frames omitted

Does anybody have an idea how I can I fix this issue that the migration to 9.7 will work?

1 Like

Hello @di.baumann ,

In 9.7, we have replaced the index projects_kee by components_kee_branch_uuid, which implies deleting projects_kee first.
For some reason, your index is not named projects_kee but "idx_336156_projects_kee", so the index stays and makes the migration fail.

Could you please provide us with more information:

  • The first version of SonarQube that was setup on that instance
  • The result of this command on the sq schema (schema name might need to be adapted):
        schemaname = 'public'
  • If you use some specific tools to backup and restore the database (such as pgloader)


The first version of SonarQube that was setup on that instance

  • I don’t know what was the first version. The only information that it is at least 4 years old.

The result of this command on the sq schema (schema name might need to be adapted):

                       tablename                        |                 indexname                 |                                                                     indexdef            
 _TransactionIndex_ef59b52a-f6f9-436f-8225-702b702e40f7 | idx_335872_pk___transac__3214ec07a8ba5553 | CREATE UNIQUE INDEX idx_335872_pk___transac__3214ec07a8ba5553 ON public."_TransactionInd
ex_ef59b52a-f6f9-436f-8225-702b702e40f7" USING btree (id)
 active_rule_parameters                                 | arp_active_rule_uuid                      | CREATE INDEX arp_active_rule_uuid ON public.active_rule_parameters USING btree (active_r
 active_rule_parameters                                 | pk_active_rule_parameters                 | CREATE UNIQUE INDEX pk_active_rule_parameters ON public.active_rule_parameters USING btr
ee (uuid)
 active_rules                                           | pk_active_rules                           | CREATE UNIQUE INDEX pk_active_rules ON public.active_rules USING btree (uuid)
 active_rules                                           | uniq_profile_rule_uuids                   | CREATE UNIQUE INDEX uniq_profile_rule_uuids ON public.active_rules USING btree (profile_
uuid, rule_uuid)
 alm_pats                                               | pk_alm_pats                               | CREATE UNIQUE INDEX pk_alm_pats ON public.alm_pats USING btree (uuid)
 alm_pats                                               | uniq_alm_pats                             | CREATE UNIQUE INDEX uniq_alm_pats ON public.alm_pats USING btree (user_uuid, alm_setting
 alm_settings                                           | pk_alm_settings                           | CREATE UNIQUE INDEX pk_alm_settings ON public.alm_settings USING btree (uuid)
 alm_settings                                           | uniq_alm_settings                         | CREATE UNIQUE INDEX uniq_alm_settings ON public.alm_settings USING btree (kee)
 analysis_properties                                    | analysis_properties_analysis              | CREATE INDEX analysis_properties_analysis ON public.analysis_properties USING btree (ana
 analysis_properties                                    | idx_335893_ix_snapshot_uuid               | CREATE INDEX idx_335893_ix_snapshot_uuid ON public.analysis_properties USING btree (anal
 analysis_properties                                    | idx_335893_pk_analysis_properties         | CREATE UNIQUE INDEX idx_335893_pk_analysis_properties ON public.analysis_properties USIN
G btree (uuid)
 app_branch_project_branch                              | idx_abpb_app_branch_uuid                  | CREATE INDEX idx_abpb_app_branch_uuid ON public.app_branch_project_branch USING btree (a
 app_branch_project_branch                              | idx_abpb_app_uuid                         | CREATE INDEX idx_abpb_app_uuid ON public.app_branch_project_branch USING btree (applicat
 app_branch_project_branch                              | idx_abpb_proj_branch_uuid                 | CREATE INDEX idx_abpb_proj_branch_uuid ON public.app_branch_project_branch USING btree (
 app_branch_project_branch                              | idx_abpb_proj_uuid                        | CREATE INDEX idx_abpb_proj_uuid ON public.app_branch_project_branch USING btree (project
 app_branch_project_branch                              | pk_app_branch_project_branch              | CREATE UNIQUE INDEX pk_app_branch_project_branch ON public.app_branch_project_branch USI
NG btree (uuid)
 app_branch_project_branch                              | uniq_app_branch_proj                      | CREATE UNIQUE INDEX uniq_app_branch_proj ON public.app_branch_project_branch USING btree
 (application_branch_uuid, project_branch_uuid)
 app_projects                                           | idx_app_proj_application_uuid             | CREATE INDEX idx_app_proj_application_uuid ON public.app_projects USING btree (applicati
 app_projects                                           | idx_app_proj_project_uuid                 | CREATE INDEX idx_app_proj_project_uuid ON public.app_projects USING btree (project_uuid)
 app_projects                                           | pk_app_projects                           | CREATE UNIQUE INDEX pk_app_projects ON public.app_projects USING btree (uuid)
 app_projects                                           | uniq_app_projects                         | CREATE UNIQUE INDEX uniq_app_projects ON public.app_projects USING btree (application_uuid, project_uuid)
 audits                                                 | audits_created_at                         | CREATE INDEX audits_created_at ON public.audits USING btree (created_at)
 audits                                                 | pk_audits                                 | CREATE UNIQUE INDEX pk_audits ON public.audits USING btree (uuid)
 ce_activity                                            | ce_activity_component                     | CREATE INDEX ce_activity_component ON public.ce_activity USING btree (component_uuid)
 ce_activity                                            | ce_activity_islast                        | CREATE INDEX ce_activity_islast ON public.ce_activity USING btree (is_last, status)
 ce_activity                                            | ce_activity_islast_key                    | CREATE INDEX ce_activity_islast_key ON public.ce_activity USING btree (is_last_key)
 ce_activity                                            | ce_activity_main_component                | CREATE INDEX ce_activity_main_component ON public.ce_activity USING btree (main_component_uuid)
 ce_activity                                            | ce_activity_main_islast                   | CREATE INDEX ce_activity_main_islast ON public.ce_activity USING btree (main_is_last, status)
 ce_activity                                            | ce_activity_main_islast_key               | CREATE INDEX ce_activity_main_islast_key ON public.ce_activity USING btree (main_is_last_key)
 ce_activity                                            | idx_335901_ce_activity_uuid               | CREATE UNIQUE INDEX idx_335901_ce_activity_uuid ON public.ce_activity USING btree (uuid)
 ce_activity                                            | pk_ce_activity                            | CREATE UNIQUE INDEX pk_ce_activity ON public.ce_activity USING btree (uuid)
 ce_queue                                               | ce_queue_component                        | CREATE INDEX ce_queue_component ON public.ce_queue USING btree (component_uuid)
 ce_queue                                               | ce_queue_main_component                   | CREATE INDEX ce_queue_main_component ON public.ce_queue USING btree (main_component_uuid)
 ce_queue                                               | idx_335910_ce_queue_uuid                  | CREATE UNIQUE INDEX idx_335910_ce_queue_uuid ON public.ce_queue USING btree (uuid)
 ce_queue                                               | pk_ce_queue                               | CREATE UNIQUE INDEX pk_ce_queue ON public.ce_queue USING btree (uuid)
 ce_scanner_context                                     | idx_335918_pk_ce_scanner_context          | CREATE UNIQUE INDEX idx_335918_pk_ce_scanner_context ON public.ce_scanner_context USING btree (task_uuid)
 ce_task_characteristics                                | idx_335924_ce_characteristics_task_uuid   | CREATE INDEX idx_335924_ce_characteristics_task_uuid ON public.ce_task_characteristics USING btree (task_uuid)
 ce_task_characteristics                                | idx_335924_pk_ce_task_characteristics     | CREATE UNIQUE INDEX idx_335924_pk_ce_task_characteristics ON public.ce_task_characteristics USING btree (uuid)
 ce_task_input                                          | idx_335930_pk_ce_task_input               | CREATE UNIQUE INDEX idx_335930_pk_ce_task_input ON public.ce_task_input USING btree (task_uuid)
 ce_task_message                                        | ce_task_message_task                      | CREATE INDEX ce_task_message_task ON public.ce_task_message USING btree (task_uuid)
 ce_task_message                                        | ctm_message_type                          | CREATE INDEX ctm_message_type ON public.ce_task_message USING btree (message_type)
 ce_task_message                                        | pk_ce_task_message                        | CREATE UNIQUE INDEX pk_ce_task_message ON public.ce_task_message USING btree (uuid)
 components                                             | idx_336156_projects_kee                   | CREATE UNIQUE INDEX idx_336156_projects_kee ON public.components USING btree (kee)
 components                                             | idx_336156_projects_module_uuid           | CREATE INDEX idx_336156_projects_module_uuid ON public.components USING btree (module_uuid)
 components                                             | idx_336156_projects_project_uuid          | CREATE INDEX idx_336156_projects_project_uuid ON public.components USING btree (project_uuid)
 components                                             | idx_336156_projects_qualifier             | CREATE INDEX idx_336156_projects_qualifier ON public.components USING btree (qualifier)
 components                                             | idx_336156_projects_root_uuid             | CREATE INDEX idx_336156_projects_root_uuid ON public.components USING btree (root_uuid)
 components                                             | idx_336156_projects_uuid                  | CREATE INDEX idx_336156_projects_uuid ON public.components USING btree (uuid)
 components                                             | idx_main_branch_prj_uuid                  | CREATE INDEX idx_main_branch_prj_uuid ON public.components USING btree (main_branch_project_uuid)
 default_qprofiles                                      | idx_335936_uniq_default_qprofiles_uuid    | CREATE UNIQUE INDEX idx_335936_uniq_default_qprofiles_uuid ON public.default_qprofiles USING btree (qprofile_uuid)
 default_qprofiles                                      | pk_default_qprofiles                      | CREATE UNIQUE INDEX pk_default_qprofiles ON public.default_qprofiles USING btree (language)
 deprecated_rule_keys                                   | pk_deprecated_rule_keys                   | CREATE UNIQUE INDEX pk_deprecated_rule_keys ON public.deprecated_rule_keys USING btree (uuid)
 deprecated_rule_keys                                   | rule_uuid_deprecated_rule_keys            | CREATE INDEX rule_uuid_deprecated_rule_keys ON public.deprecated_rule_keys USING btree (rule_uuid)
 deprecated_rule_keys                                   | uniq_deprecated_rule_keys                 | CREATE UNIQUE INDEX uniq_deprecated_rule_keys ON public.deprecated_rule_keys USING btree (old_repository_key, old_rule_key)
 duplications_index                                     | idx_335944_duplication_analysis_component | CREATE INDEX idx_335944_duplication_analysis_component ON public.duplications_index USING btree (analysis_uuid, component_uuid)
 duplications_index                                     | idx_335944_duplications_index_hash        | CREATE INDEX idx_335944_duplications_index_hash ON public.duplications_index USING btree (hash)
 duplications_index                                     | pk_duplications_index                     | CREATE UNIQUE INDEX pk_duplications_index ON public.duplications_index USING btree (uuid)
 es_queue                                               | idx_335951_es_queue_created_at            | CREATE INDEX idx_335951_es_queue_created_at ON public.es_queue USING btree (created_at)
 es_queue                                               | idx_335951_pk_es_queue                    | CREATE UNIQUE INDEX idx_335951_pk_es_queue ON public.es_queue USING btree (uuid)
 event_component_changes                                | event_component_changes_unique            | CREATE UNIQUE INDEX event_component_changes_unique ON public.event_component_changes USING btree (event_uuid, change_category, component_uuid)
 event_component_changes                                | event_cpnt_changes_analysis               | CREATE INDEX event_cpnt_changes_analysis ON public.event_component_changes USING btree (event_analysis_uuid)
 event_component_changes                                | event_cpnt_changes_cpnt                   | CREATE INDEX event_cpnt_changes_cpnt ON public.event_component_changes USING btree (event_component_uuid)
 event_component_changes                                | pk_event_component_changes                | CREATE UNIQUE INDEX pk_event_component_changes ON public.event_component_changes USING btree (uuid)
 events                                                 | idx_335959_events_analysis                | CREATE INDEX idx_335959_events_analysis ON USING btree (analysis_uuid)
 events                                                 | idx_335959_events_component_uuid          | CREATE INDEX idx_335959_events_component_uuid ON USING btree (component_uuid)
 events                                                 | idx_335959_events_uuid                    | CREATE UNIQUE INDEX idx_335959_events_uuid ON USING btree (uuid)
 events                                                 | pk_events                                 | CREATE UNIQUE INDEX pk_events ON USING btree (uuid)
 file_sources                                           | file_sources_file_uuid                    | CREATE UNIQUE INDEX file_sources_file_uuid ON public.file_sources USING btree (file_uuid)
 file_sources                                           | idx_335968_file_sources_project_uuid      | CREATE INDEX idx_335968_file_sources_project_uuid ON public.file_sources USING btree (project_uuid)
 file_sources                                           | idx_335968_file_sources_updated_at        | CREATE INDEX idx_335968_file_sources_updated_at ON public.file_sources USING btree (updated_at)
 file_sources                                           | pk_file_sources                           | CREATE UNIQUE INDEX pk_file_sources ON public.file_sources USING btree (uuid)
 group_roles                                            | group_roles_component_uuid                | CREATE INDEX group_roles_component_uuid ON public.group_roles USING btree (component_uuid)
 group_roles                                            | pk_group_roles                            | CREATE UNIQUE INDEX pk_group_roles ON public.group_roles USING btree (uuid)
 group_roles                                            | uniq_group_roles                          | CREATE UNIQUE INDEX uniq_group_roles ON public.group_roles USING btree (group_uuid, component_uuid, role)
 groups                                                 | pk_groups                                 | CREATE UNIQUE INDEX pk_groups ON public.groups USING btree (uuid)
 groups                                                 | uniq_groups_name                          | CREATE UNIQUE INDEX uniq_groups_name ON public.groups USING btree (name)
 groups_users                                           | groups_users_unique                       | CREATE UNIQUE INDEX groups_users_unique ON public.groups_users USING btree (user_uuid, group_uuid)
 groups_users                                           | index_groups_users_group_uuid             | CREATE INDEX index_groups_users_group_uuid ON public.groups_users USING btree (group_uuid)
 groups_users                                           | index_groups_users_user_uuid              | CREATE INDEX index_groups_users_user_uuid ON public.groups_users USING btree (user_uuid)
 internal_component_props                               | pk_internal_component_props               | CREATE UNIQUE INDEX pk_internal_component_props ON public.internal_component_props USING btree (uuid)
 internal_component_props                               | unique_component_uuid_kee                 | CREATE UNIQUE INDEX unique_component_uuid_kee ON public.internal_component_props USING btree (component_uuid, kee)
 internal_properties                                    | idx_335996_pk_internal_properties         | CREATE UNIQUE INDEX idx_335996_pk_internal_properties ON public.internal_properties USING btree (kee)
 issue_changes                                          | issue_changes_issue_key                   | CREATE INDEX issue_changes_issue_key ON public.issue_changes USING btree (issue_key)
 issue_changes                                          | issue_changes_issue_key_type              | CREATE INDEX issue_changes_issue_key_type ON public.issue_changes USING btree (issue_key, change_type)
 issue_changes                                          | issue_changes_kee                         | CREATE INDEX issue_changes_kee ON public.issue_changes USING btree (kee)
 issue_changes                                          | issue_changes_project_uuid                | CREATE INDEX issue_changes_project_uuid ON public.issue_changes USING btree (project_uuid)
 issue_changes                                          | pk_issue_changes                          | CREATE UNIQUE INDEX pk_issue_changes ON public.issue_changes USING btree (uuid)
 issues                                                 | issues_assignee                           | CREATE INDEX issues_assignee ON public.issues USING btree (assignee)
 issues                                                 | issues_component_uuid                     | CREATE INDEX issues_component_uuid ON public.issues USING btree (component_uuid)
 issues                                                 | issues_creation_date                      | CREATE INDEX issues_creation_date ON public.issues USING btree (issue_creation_date)
 issues                                                 | issues_project_uuid                       | CREATE INDEX issues_project_uuid ON public.issues USING btree (project_uuid)
 issues                                                 | issues_resolution                         | CREATE INDEX issues_resolution ON public.issues USING btree (resolution)
 issues                                                 | issues_rule_uuid                          | CREATE INDEX issues_rule_uuid ON public.issues USING btree (rule_uuid)
 issues                                                 | issues_updated_at                         | CREATE INDEX issues_updated_at ON public.issues USING btree (updated_at)
 issues                                                 | pk_issues                                 | CREATE UNIQUE INDEX pk_issues ON public.issues USING btree (kee)
 live_measures                                          | live_measures_component                   | CREATE UNIQUE INDEX live_measures_component ON public.live_measures USING btree (component_uuid, metric_uuid)
 live_measures                                          | live_measures_project                     | CREATE INDEX live_measures_project ON public.live_measures USING btree (project_uuid)
 live_measures                                          | pk_live_measures                          | CREATE UNIQUE INDEX pk_live_measures ON public.live_measures USING btree (uuid)
 metrics                                                | idx_336040_metrics_unique_name            | CREATE UNIQUE INDEX idx_336040_metrics_unique_name ON public.metrics USING btree (name)
 metrics                                                | pk_metrics                                | CREATE UNIQUE INDEX pk_metrics ON public.metrics USING btree (uuid)
 new_code_periods                                       | idx_ncp_type                              | CREATE INDEX idx_ncp_type ON public.new_code_periods USING btree (type)
 new_code_periods                                       | idx_ncp_value                             | CREATE INDEX idx_ncp_value ON public.new_code_periods USING btree (value)
 new_code_periods                                       | pk_new_code_periods                       | CREATE UNIQUE INDEX pk_new_code_periods ON public.new_code_periods USING btree (uuid)
 new_code_periods                                       | uniq_new_code_periods                     | CREATE UNIQUE INDEX uniq_new_code_periods ON public.new_code_periods USING btree (project_uuid, branch_uuid)
 new_code_reference_issues                              | pk_new_code_reference_issues              | CREATE UNIQUE INDEX pk_new_code_reference_issues ON public.new_code_reference_issues USING btree (uuid)
 new_code_reference_issues                              | uniq_new_code_reference_issues            | CREATE UNIQUE INDEX uniq_new_code_reference_issues ON public.new_code_reference_issues USING btree (issue_key)
 notifications                                          | pk_notifications                          | CREATE UNIQUE INDEX pk_notifications ON public.notifications USING btree (uuid)
 org_qprofiles                                          | idx_336060_pk_org_qprofiles               | CREATE UNIQUE INDEX idx_336060_pk_org_qprofiles ON public.org_qprofiles USING btree (uuid)
 org_qprofiles                                          | idx_336060_qprofiles_rp_uuid              | CREATE INDEX idx_336060_qprofiles_rp_uuid ON public.org_qprofiles USING btree (rules_profile_uuid)
 org_qprofiles                                          | org_qprofiles_parent_uuid                 | CREATE INDEX org_qprofiles_parent_uuid ON public.org_qprofiles USING btree (parent_uuid)
 perm_templates_groups                                  | pk_perm_templates_groups                  | CREATE UNIQUE INDEX pk_perm_templates_groups ON public.perm_templates_groups USING btree (uuid)
 perm_templates_users                                   | pk_perm_templates_users                   | CREATE UNIQUE INDEX pk_perm_templates_users ON public.perm_templates_users USING btree (uuid)
 perm_tpl_characteristics                               | pk_perm_tpl_characteristics               | CREATE UNIQUE INDEX pk_perm_tpl_characteristics ON public.perm_tpl_characteristics USING btree (uuid)
 perm_tpl_characteristics                               | uniq_perm_tpl_charac                      | CREATE UNIQUE INDEX uniq_perm_tpl_charac ON public.perm_tpl_characteristics USING btree (template_uuid, permission_key)
 permission_templates                                   | pk_permission_templates                   | CREATE UNIQUE INDEX pk_permission_templates ON public.permission_templates USING btree (uuid)
 plugins                                                | idx_336115_pk_plugins                     | CREATE UNIQUE INDEX idx_336115_pk_plugins ON public.plugins USING btree (uuid)
 plugins                                                | idx_336115_plugins_key                    | CREATE UNIQUE INDEX idx_336115_plugins_key ON public.plugins USING btree (kee)
 portfolio_proj_branches                                | pk_portfolio_proj_branches                | CREATE UNIQUE INDEX pk_portfolio_proj_branches ON public.portfolio_proj_branches USING btree (uuid)
 portfolio_projects                                     | pk_portfolio_projects                     | CREATE UNIQUE INDEX pk_portfolio_projects ON public.portfolio_projects USING btree (uuid)
 portfolio_projects                                     | uniq_portfolio_projects                   | CREATE UNIQUE INDEX uniq_portfolio_projects ON public.portfolio_projects USING btree (portfolio_uuid, project_uuid)
 portfolio_references                                   | pk_portfolio_references                   | CREATE UNIQUE INDEX pk_portfolio_references ON public.portfolio_references USING btree (uuid)
 portfolio_references                                   | uniq_portfolio_references                 | CREATE UNIQUE INDEX uniq_portfolio_references ON public.portfolio_references USING btree (portfolio_uuid, reference_uuid, branch_uuid)
 portfolios                                             | pk_portfolios                             | CREATE UNIQUE INDEX pk_portfolios ON public.portfolios USING btree (uuid)
 portfolios                                             | uniq_portfolios_kee                       | CREATE UNIQUE INDEX uniq_portfolios_kee ON public.portfolios USING btree (kee)
 project_alm_settings                                   | pk_project_alm_settings                   | CREATE UNIQUE INDEX pk_project_alm_settings ON public.project_alm_settings USING btree (uuid)
 project_alm_settings                                   | project_alm_settings_alm                  | CREATE INDEX project_alm_settings_alm ON public.project_alm_settings USING btree (alm_setting_uuid)
 project_alm_settings                                   | project_alm_settings_slug                 | CREATE INDEX project_alm_settings_slug ON public.project_alm_settings USING btree (alm_slug)
 project_alm_settings                                   | uniq_project_alm_settings                 | CREATE UNIQUE INDEX uniq_project_alm_settings ON public.project_alm_settings USING btree (project_uuid)
 project_badge_token                                    | pk_project_badge_token                    | CREATE UNIQUE INDEX pk_project_badge_token ON public.project_badge_token USING btree (uuid)
 project_badge_token                                    | uniq_project_badge_token                  | CREATE UNIQUE INDEX uniq_project_badge_token ON public.project_badge_token USING btree (project_uuid)
 project_branches                                       | idx_336121_pk_project_branches            | CREATE UNIQUE INDEX idx_336121_pk_project_branches ON public.project_branches USING btree (uuid)
 project_branches                                       | idx_336121_project_branches_kee           | CREATE UNIQUE INDEX idx_336121_project_branches_kee ON public.project_branches USING btree (project_uuid, kee)
 project_branches                                       | uniq_project_branches                     | CREATE UNIQUE INDEX uniq_project_branches ON public.project_branches USING btree (branch_type, project_uuid, kee)
 project_links                                          | pk_project_links2                         | CREATE UNIQUE INDEX pk_project_links2 ON public.project_links USING btree (uuid)
 project_links                                          | project_links_project                     | CREATE INDEX project_links_project ON public.project_links USING btree (project_uuid)
 project_mappings                                       | key_type_kee                              | CREATE UNIQUE INDEX key_type_kee ON public.project_mappings USING btree (key_type, kee)
 project_mappings                                       | pk_project_mappings                       | CREATE UNIQUE INDEX pk_project_mappings ON public.project_mappings USING btree (uuid)
 project_mappings                                       | project_uuid                              | CREATE INDEX project_uuid ON public.project_mappings USING btree (project_uuid)
 project_measures                                       | idx_336138_measures_component_uuid        | CREATE INDEX idx_336138_measures_component_uuid ON public.project_measures USING btree (component_uuid)
 project_measures                                       | idx_336138_measures_person                | CREATE INDEX idx_336138_measures_person ON public.project_measures USING btree (person_id)
 project_measures                                       | measures_analysis_metric                  | CREATE INDEX measures_analysis_metric ON public.project_measures USING btree (analysis_uuid, metric_uuid)
 project_measures                                       | pk_project_measures                       | CREATE UNIQUE INDEX pk_project_measures ON public.project_measures USING btree (uuid)
 project_qgates                                         | pk_project_qgates                         | CREATE UNIQUE INDEX pk_project_qgates ON public.project_qgates USING btree (project_uuid)
 project_qgates                                         | uniq_project_qgates                       | CREATE UNIQUE INDEX uniq_project_qgates ON public.project_qgates USING btree (project_uuid, quality_gate_uuid)
 project_qprofiles                                      | idx_336147_uniq_project_qprofiles         | CREATE UNIQUE INDEX idx_336147_uniq_project_qprofiles ON public.project_qprofiles USING btree (project_uuid, profile_key)
 project_qprofiles                                      | pk_project_qprofiles                      | CREATE UNIQUE INDEX pk_project_qprofiles ON public.project_qprofiles USING btree (uuid)
 projects                                               | idx_qualifier                             | CREATE INDEX idx_qualifier ON public.projects USING btree (qualifier)
 projects                                               | pk_new_projects                           | CREATE UNIQUE INDEX pk_new_projects ON public.projects USING btree (uuid)
 projects                                               | uniq_projects_kee                         | CREATE UNIQUE INDEX uniq_projects_kee ON public.projects USING btree (kee)
 properties                                             | idx_336166_properties_key                 | CREATE INDEX idx_336166_properties_key ON USING btree (prop_key)
 properties                                             | pk_properties                             | CREATE UNIQUE INDEX pk_properties ON USING btree (uuid)
 push_events                                            | idx_push_even_crea_uuid_proj              | CREATE INDEX idx_push_even_crea_uuid_proj ON public.push_events USING btree (created_at, uuid, project_uuid)
 push_events                                            | pk_push_events                            | CREATE UNIQUE INDEX pk_push_events ON public.push_events USING btree (uuid)
 qgate_group_permissions                                | pk_qgate_group_permissions                | CREATE UNIQUE INDEX pk_qgate_group_permissions ON public.qgate_group_permissions USING btree (uuid)
 qgate_group_permissions                                | qg_groups_uuid_idx                        | CREATE INDEX qg_groups_uuid_idx ON public.qgate_group_permissions USING btree (quality_gate_uuid)
 qgate_user_permissions                                 | pk_qgate_user_permissions                 | CREATE UNIQUE INDEX pk_qgate_user_permissions ON public.qgate_user_permissions USING btree (uuid)
 qgate_user_permissions                                 | quality_gate_uuid_idx                     | CREATE INDEX quality_gate_uuid_idx ON public.qgate_user_permissions USING btree (quality_gate_uuid)
 qprofile_changes                                       | idx_336173_pk_qprofile_changes            | CREATE UNIQUE INDEX idx_336173_pk_qprofile_changes ON public.qprofile_changes USING btree (kee)
 qprofile_changes                                       | idx_336173_qp_changes_rules_profile_uuid  | CREATE INDEX idx_336173_qp_changes_rules_profile_uuid ON public.qprofile_changes USING btree (rules_profile_uuid)
 qprofile_edit_groups                                   | idx_336179_pk_qprofile_edit_groups        | CREATE UNIQUE INDEX idx_336179_pk_qprofile_edit_groups ON public.qprofile_edit_groups USING btree (uuid)
 qprofile_edit_groups                                   | idx_336179_qprofile_edit_groups_qprofile  | CREATE INDEX idx_336179_qprofile_edit_groups_qprofile ON public.qprofile_edit_groups USING btree (qprofile_uuid)
 qprofile_edit_groups                                   | qprofile_edit_groups_unique               | CREATE UNIQUE INDEX qprofile_edit_groups_unique ON public.qprofile_edit_groups USING btree (group_uuid, qprofile_uuid)
 qprofile_edit_users                                    | idx_336185_pk_qprofile_edit_users         | CREATE UNIQUE INDEX idx_336185_pk_qprofile_edit_users ON public.qprofile_edit_users USING btree (uuid)
 qprofile_edit_users                                    | idx_336185_qprofile_edit_users_qprofile   | CREATE INDEX idx_336185_qprofile_edit_users_qprofile ON public.qprofile_edit_users USING btree (qprofile_uuid)
 qprofile_edit_users                                    | qprofile_edit_users_unique                | CREATE UNIQUE INDEX qprofile_edit_users_unique ON public.qprofile_edit_users USING btree (user_uuid, qprofile_uuid)
 quality_gate_conditions                                | pk_quality_gate_conditions                | CREATE UNIQUE INDEX pk_quality_gate_conditions ON public.quality_gate_conditions USING btree (uuid)
 quality_gates                                          | idx_336202_uniq_quality_gates             | CREATE UNIQUE INDEX idx_336202_uniq_quality_gates ON public.quality_gates USING btree (name)
 quality_gates                                          | pk_quality_gates                          | CREATE UNIQUE INDEX pk_quality_gates ON public.quality_gates USING btree (uuid)
 rule_desc_sections                                     | pk_rule_desc_sections                     | CREATE UNIQUE INDEX pk_rule_desc_sections ON public.rule_desc_sections USING btree (uuid)
 rule_desc_sections                                     | uniq_rule_desc_sections                   | CREATE UNIQUE INDEX uniq_rule_desc_sections ON public.rule_desc_sections USING btree (rule_uuid, kee, context_key)
 rule_repositories                                      | idx_336209_pk_rule_repositories           | CREATE UNIQUE INDEX idx_336209_pk_rule_repositories ON public.rule_repositories USING btree (kee)
 rules                                                  | idx_336217_rules_repo_key                 | CREATE UNIQUE INDEX idx_336217_rules_repo_key ON public.rules USING btree (plugin_name, plugin_rule_key)
 rules                                                  | pk_rules                                  | CREATE UNIQUE INDEX pk_rules ON public.rules USING btree (uuid)
 rules_parameters                                       | pk_rules_parameters                       | CREATE UNIQUE INDEX pk_rules_parameters ON public.rules_parameters USING btree (uuid)
 rules_parameters                                       | rules_parameters_rule_uuid                | CREATE INDEX rules_parameters_rule_uuid ON public.rules_parameters USING btree (rule_uuid)
 rules_parameters                                       | rules_parameters_unique                   | CREATE UNIQUE INDEX rules_parameters_unique ON public.rules_parameters USING btree (rule_uuid, name)
 rules_profiles                                         | pk_rules_profiles                         | CREATE UNIQUE INDEX pk_rules_profiles ON public.rules_profiles USING btree (uuid)
 saml_message_ids                                       | pk_saml_message_ids                       | CREATE UNIQUE INDEX pk_saml_message_ids ON public.saml_message_ids USING btree (uuid)
 saml_message_ids                                       | saml_message_ids_unique                   | CREATE UNIQUE INDEX saml_message_ids_unique ON public.saml_message_ids USING btree (message_id)
 scanner_analysis_cache                                 | pk_scanner_analysis_cache                 | CREATE UNIQUE INDEX pk_scanner_analysis_cache ON public.scanner_analysis_cache USING btree (branch_uuid)
 schema_migrations                                      | idx_336249_unique_schema_migrations       | CREATE INDEX idx_336249_unique_schema_migrations ON public.schema_migrations USING btree (version)
 session_tokens                                         | pk_session_tokens                         | CREATE UNIQUE INDEX pk_session_tokens ON public.session_tokens USING btree (uuid)
 session_tokens                                         | session_tokens_user_uuid                  | CREATE INDEX session_tokens_user_uuid ON public.session_tokens USING btree (user_uuid)
 snapshots                                              | idx_336257_analyses_uuid                  | CREATE UNIQUE INDEX idx_336257_analyses_uuid ON public.snapshots USING btree (uuid)
 snapshots                                              | idx_336257_snapshot_component             | CREATE INDEX idx_336257_snapshot_component ON public.snapshots USING btree (component_uuid)
 snapshots                                              | pk_snapshots                              | CREATE UNIQUE INDEX pk_snapshots ON public.snapshots USING btree (uuid)
 user_dismissed_messages                                | pk_user_dismissed_messages                | CREATE UNIQUE INDEX pk_user_dismissed_messages ON public.user_dismissed_messages USING btree (uuid)
 user_dismissed_messages                                | udm_message_type                          | CREATE INDEX udm_message_type ON public.user_dismissed_messages USING btree (message_type)
 user_dismissed_messages                                | udm_project_uuid                          | CREATE INDEX udm_project_uuid ON public.user_dismissed_messages USING btree (project_uuid)
 user_dismissed_messages                                | uniq_user_dismissed_messages              | CREATE UNIQUE INDEX uniq_user_dismissed_messages ON public.user_dismissed_messages USING btree (user_uuid, project_uuid, message_type)
 user_roles                                             | pk_user_roles                             | CREATE UNIQUE INDEX pk_user_roles ON public.user_roles USING btree (uuid)
 user_roles                                             | user_roles_component_uuid                 | CREATE INDEX user_roles_component_uuid ON public.user_roles USING btree (component_uuid)
 user_roles                                             | user_roles_user                           | CREATE INDEX user_roles_user ON public.user_roles USING btree (user_uuid)
 user_tokens                                            | idx_336277_user_tokens_login_name         | CREATE UNIQUE INDEX idx_336277_user_tokens_login_name ON public.user_tokens USING btree (user_uuid, name)
 user_tokens                                            | idx_336277_user_tokens_token_hash         | CREATE UNIQUE INDEX idx_336277_user_tokens_token_hash ON public.user_tokens USING btree (token_hash)
 user_tokens                                            | pk_user_tokens                            | CREATE UNIQUE INDEX pk_user_tokens ON public.user_tokens USING btree (uuid)
 user_tokens                                            | user_tokens_user_uuid_name                | CREATE UNIQUE INDEX user_tokens_user_uuid_name ON public.user_tokens USING btree (user_uuid, name)
 users                                                  | idx_336286_users_login                    | CREATE UNIQUE INDEX idx_336286_users_login ON public.users USING btree (login)
 users                                                  | idx_336286_users_updated_at               | CREATE INDEX idx_336286_users_updated_at ON public.users USING btree (updated_at)
 users                                                  | pk_users                                  | CREATE UNIQUE INDEX pk_users ON public.users USING btree (uuid)
 users                                                  | uniq_external_id                          | CREATE UNIQUE INDEX uniq_external_id ON public.users USING btree (external_identity_provider, external_id)
 users                                                  | uniq_external_login                       | CREATE UNIQUE INDEX uniq_external_login ON public.users USING btree (external_identity_provider, external_login)
 users                                                  | users_login                               | CREATE UNIQUE INDEX users_login ON public.users USING btree (login)
 webhook_deliveries                                     | idx_336294_ce_task_uuid                   | CREATE INDEX idx_336294_ce_task_uuid ON public.webhook_deliveries USING btree (ce_task_uuid)
 webhook_deliveries                                     | idx_336294_component_uuid                 | CREATE INDEX idx_336294_component_uuid ON public.webhook_deliveries USING btree (component_uuid)
 webhook_deliveries                                     | idx_336294_pk_webhook_deliveries          | CREATE UNIQUE INDEX idx_336294_pk_webhook_deliveries ON public.webhook_deliveries USING btree (uuid)
 webhook_deliveries                                     | idx_wbhk_dlvrs_wbhk_uuid                  | CREATE INDEX idx_wbhk_dlvrs_wbhk_uuid ON public.webhook_deliveries USING btree (webhook_uuid)
 webhooks                                               | pk_webhooks                               | CREATE UNIQUE INDEX pk_webhooks ON public.webhooks USING btree (uuid)
(209 rows)

If you use some specific tools to backup and restore the database (such as pgloader)

  • I don’t use some specific tool. I hoste my Sonarqube instance on Azure and use the Azure Point-in-time restore functionality.
  • The db was moved to azure last year with pg_dump.
1 Like

Hello @di.baumann
For information, we have worked on this ticket for 9.9, so it is easier for users that have “special” index name (such as idx_{number}_{indexName}) to do their migrations since we saw it was a common recurrence.

In your case, in order to fix the migration, you can remove manually the index “idx_336156_projects_kee” so the migration can proceed, or wait for the release of 9.9 to fix the issue


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.