Problem during db migration from LTS 6.7.4 to LTS 7.9


During Database migration, I get the following stacktrace. I’m trying to upgrade from 6.7.4 to 7.9. Could it be due to the fact I haven’t upgraded to latest 6.7 LTS ?
Thank you

2019.07.02 16:49:12 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration ended with an exception
org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #1945 'Delete file measures' failed
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(
	at java.base/java.lang.Iterable.forEach(
	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: [uuid=b031b1cd-3eb7-45e7-bda6-139ecc4c105d]
	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.v70.DeleteFileMeasures.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: Incorrect syntax near 'pm'.
	at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(
	at org.apache.commons.dbcp2.DelegatingStatement.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


Can you give some more details like database platform (Postgres, MSSQL, Oracle) and version (MSSQL 2014, for example)?


1 Like


It’s MSSQL SQL Server v2014.

I guess there is a problem with the statement used in DeleteFileMeasures :

delete from project_measures pm where pm.component_uuid=?

It can’t work on my instance of SQL Server because of the alias ‘pm’ used in statement.

delete from project_measures where component_uuid=?

would work.

I don’t know if it’s specific to my environment.

Judging from this entry, you must use the ‘AS’ keywork in a DELETE statement. Don’t know why.
So the correct statement should be

delete from project_measures AS pm where pm.component_uuid=?


Thanks for the investigation!

A ticket has been created which will make its way into a 7.9.1 release SONAR-12260

This, combined with SONAR-12251, might be good enough reason to wait for a 7.9.1 release to make the upgrade.


1 Like

Hi ,
I am facing the same issue, migrating from 6.7.3 to 7.9.
Is there any workaround that I can use to fix this up ?

Please suggest if there is a way to currently fix this in 7.9.

Until a fix is released I’d recommend reverting to a backup of your 6.7 instance.

Currently we migrated to open Jdk11 , after that coverage is shown as 0 in sonar 6.7.3.
That’s why we needed to migrated urgently to 7.9.

Please suggest if I can proceed with 6.7.3 without coverage issue.


It sounds like you may have jumped to a conclusion that v7.9 LTS will fix your coverage reporting issue, and I don’t think there’s any guarantee of that. I would recommend opening a new thread with those details in the context of your v6.7 install.


1 Like

Hi Colin,
actually I set up 7.9 from scratch and my coverage worked fine.
Now the issue is I need to upgrade my existing sonar db so that I do not lose any data.
Thanks in advance for quick turnaround.