Failed to migrate database after migrate to 9.5

After upgrading to the 9.5, the setup process failed with the following error:
org.postgresql.util.PSQLException: ERROR: mergejoin input data is out of order

after executing the following query:

select rds.content as “rds_content”, rds.uuid as “rds_uuid”, rds.kee as “rds_kee”, r.uuid as “r_uuid”, r.plugin_rule_key as “ruleKey”, r.plugin_name as “repositoryKey”, r.description_format as “descriptionFormat”, r.status,, r.plugin_config_key as “configKey”, r.priority as “severity”, r.is_template as “isTemplate”, r.is_external as “isExternal”, r.is_ad_hoc as “isAdHoc”, r.language as “language”, r.template_uuid as “templateUuid”, r.def_remediation_function as “defRemediationFunction”, r.def_remediation_gap_mult as “defRemediationGapMultiplier”, r.def_remediation_base_effort as “defRemediationBaseEffort”, r.gap_description as “gapDescription”, r.system_tags as “systemTagsField”, r.security_standards as “securityStandardsField”, r.rule_type as “type”, r.plugin_key as “pluginKey”, r.scope, r.created_at as “createdAt”, r.updated_at as “updatedAt”, r.note_data as “noteData”, r.note_user_uuid as “noteUserUuid”, r.note_created_at as “noteCreatedAt”, r.note_updated_at as “noteUpdatedAt”, r.remediation_function as “remediationFunction”, r.remediation_gap_mult as “remediationGapMultiplier”, r.remediation_base_effort as “remediationBaseEffort”, r.tags as “tagsField”, r.ad_hoc_name as “adHocName”, r.ad_hoc_description as “adHocDescription”, r.ad_hoc_severity as “adHocSeverity”, r.ad_hoc_type as “adHocType” from rules r left outer join rule_desc_sections rds on rds.rule_uuid = r.uuid

That made my database inconsistent and now my sonar instance won’t run with the following error:
org.sonar.server.exceptions.BadRequestException: Rule with UUID AX2_I9xF-Xhu6cui6fS_ not found

I’m running a PostgreSQL 10.21 and when I run that query with a pg client I get no errors.

Any ideas?

Hello @pere.toran,

Welcome to the community and thanks for your report!

I have a few questions:

  • do you see this error during the migration, when SonarQube starts up, or while trying to display a page?
  • do you have the full stacktrace?
  • from which version were you migrating?
  • when you say that your instance won’t run, you mean that it completely fails to start?

Thanks for the update,


I saw that error during the migration (after accessing the /setup URL) from the 9.4 to the 9.5 version, and from now on, every time I tried to start SonarQube (docker start) it failed with the org.sonar.server.exceptions.BadRequestException: Rule with UUID AX2_I9xF-Xhu6cui6fS_ not found error.

After digging more into this, I discovered that the the rules table was not behaving correctly (I couldn’t perform a simple select * from rules where uuid = ‘AX2_I9xF-Xhu6cui6fS_’ even though the row was there).
So, I ran a REINDEX on the rule table index and everything worked fine. I suspect that the initial error mergejoin input data is out of order was due to the index being corrupted.
Weirdest thing I’ve seen in months.

1 Like

I’m glad to hear that you found a solution to your problem! I’m marking this thread as resolved.


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