postgresql.util.PSQLException: ERROR: mergejoin input data is out of order

we have upgraded to latest version

  • Developer Edition

    v2025.4.2 (112048)

  • then migrated from centOS server to Rocky Linux server 9.6, we are seeing below DB error

can you suggest how to fix

Error Details

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: mergejoin input data is out of order
### The error may exist in org.sonar.db.rule.RuleMapper
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select                  rdi.rule_uuid as "rdi_ruleUuid",     rdi.software_quality as "rdi_softwareQuality",     rdi.severity as "rdi_severity",          CASE WHEN rt.is_system_tag = true THEN rt.value ELSE NULL END as rt_systemTags,     CASE WHEN rt.is_system_tag = false THEN rt.value ELSE NULL END as rt_tags,     rt.is_system_tag as "rt_isSystemTag",     rt.value as "rt_value",          rds.content as "rds_content",     rds.uuid as "rds_uuid",     rds.kee as "rds_kee",     rds.context_key as "rds_contextKey",     rds.context_display_name as "rds_contextDisplayName",          r.uuid as "r_uuid",           r.plugin_rule_key as "ruleKey",     r.plugin_name as "repositoryKey",     r.description_format as "descriptionFormat",     r.status,     r.name,     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.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.ad_hoc_name as "adHocName",     r.ad_hoc_description as "adHocDescription",     r.ad_hoc_severity as "adHocSeverity",     r.ad_hoc_type as "adHocType",     r.education_principles as "educationPrinciplesField",     r.clean_code_attribute as "cleanCodeAttribute"             from       rules r           left outer join rule_desc_sections rds on       rds.rule_uuid = r.uuid               left outer join rules_default_impacts rdi on       rdi.rule_uuid = r.uuid               left outer join rule_tags rt on       rt.rule_uuid = r.uuid         order by r.uuid
### Cause: org.postgresql.util.PSQLException: ERROR: mergejoin input data is out of order
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:156)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:142)
	at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
	at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:141)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
	at jdk.proxy2/jdk.proxy2.$Proxy70.selectAll(Unknown Source)
	at org.sonar.db.rule.RuleDao.selectAll(RuleDao.java:92)
	at org.sonar.ce.task.projectanalysis.issue.RuleRepositoryImpl.loadRulesFromDb(RuleRepositoryImpl.java:140)
	at org.sonar.ce.task.projectanalysis.issue.RuleRepositoryImpl.ensureInitialized(RuleRepositoryImpl.java:130)
	at org.sonar.ce.task.projectanalysis.issue.RuleRepositoryImpl.findByKey(RuleRepositoryImpl.java:102)
	at org.sonar.ce.task.projectanalysis.step.LoadQualityProfilesStep.execute(LoadQualityProfilesStep.java:60)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:90)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:81)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:68)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:212)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:194)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:160)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:135)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:87)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:128)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:80)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.postgresql.util.PSQLException: ERROR: mergejoin input data is out of order
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2734)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2421)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:518)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:435)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:196)
	at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:182)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:80)
	at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:62)
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:336)
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:158)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:110)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:90)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:154)
	... 31 more
bash-5.1$ /usr/pgsql-15/bin/vacuumdb --all --analyze-in-stages
could not change directory to “/root”: Permission denied
WARNING:  database “postgres” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
WARNING:  database “postgres” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “postgres”: Generating minimal optimizer statistics (1 target)
WARNING:  database “sonarqube” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE sonarqube REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “sonarqube”: Generating minimal optimizer statistics (1 target)
WARNING:  database “template1” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “template1”: Generating minimal optimizer statistics (1 target)
WARNING:  database “postgres” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “postgres”: Generating medium optimizer statistics (10 targets)
WARNING:  database “sonarqube” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE sonarqube REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “sonarqube”: Generating medium optimizer statistics (10 targets)
WARNING:  database “template1” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “template1”: Generating medium optimizer statistics (10 targets)
WARNING:  database “postgres” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “postgres”: Generating default (full) optimizer statistics
WARNING:  database “sonarqube” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE sonarqube REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “sonarqube”: Generating default (full) optimizer statistics
WARNING:  database “template1” has a collation version mismatch
DETAIL:  The database was created using collation version 2.17, but the operating system provides version 2.34.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
vacuumdb: processing database “template1”: Generating default (full) optimizer statistics
bash-5.1$ id
uid=26(postgres) gid=26(postgres) groups=26(postgres)
bash-5.1$ cat /etc/redhat-release
Rocky Linux release 9.6 (Blue Onyx)
bash-5.1$

Hi,

Could you provide at least a few log lines leading up to that exception, please?

 
Thx,
Ann