Upgrade postgres from 9.6 to 13

Currently we are using sonar 8.x and postgres 9.6.2 in kubernes cluster

We are trying to upgrade sonar 9.2 and postgres 13

But unable to upgrade data form postgres 9.6.2 to 13.

Can some one please help in this? Steps to upgrade?


Welcome to the community!

Unfortunately, your Postgres upgrade is entirely out of scope for this community.


But how do we upgrade from sonar 8.x to 9.2 along with databases ?

sonarqube is trying to create the tables ok existing database when upgrading sonar


I don’t understand the question.

During a SonarQube upgrade, SonarQube does take care of making necessary changes to its own schema. That should be unrelated to upgrading your Postgres version.


Here is my question:

My current environment: sonar 8.x and postgres 9.6

I would like to migrate to: sonar 9.2 and postgres 13.

Shall I directly install sonar along with postgres 13?

In the new sonar 9.2 I would like to see the data which is in old database postgres 9.6.

What I have done:

We have installed postgres 13. Stopped new sonar. And now migrated the data from old postgres 9.6 database to new postgres 13. No errors. Installed new sonar 9.2 with postgres 13 database configuration.

Started Sonar, it’s failing with errors

Execute DB migration: failure

Create initial schema failed.

ERROR: relation “active_rules_parameters” already exists.

Can you please suggest the best way to upgrade to new sonar.


Thanks for the clarification. SonarQube 8.9.* LTS supports both Postgres 9.6 and Postgres 13. The same is true of the latest version, SonarQube 9.4.

So your Postgres upgrade is independent of your SonarQube upgrade. Just to keep things simple, I would upgrade Postgres first & make sure everything is as it should be. That includes pointing your SonarQube instance at its schema in the upgraded DB & making sure it starts & runs properly. Then you can upgrade SonarQube:

  • 8.x → 8.9.8
  • 8.9.8 → 9.4

With each SonarQube upgrade step, you’ll need to start SonarQube up & have it update its database schema. That’s a standard part of the upgrade procedure and perhaps what got missed when you tried this before? It’s also worth being explicit that you can’t jump straight from 8.* to 9.4. You must stop in the middle at the LTS version.

Yup! That’s how it works. :slight_smile:
In an upgrade, you point the new SonarQube version to your database & all the data is retained & still available.