Postgres database has a collation version mismatch

After upgrade from 25.12.0.117093 to 26.1.0.118079 (hosted in docker compose) I realized several warning messages from the the database.

db-1         | 2026-02-02 16:30:43.840 UTC [58] WARNING:  database "sonar" has a collation version mismatch
db-1         | 2026-02-02 16:30:43.840 UTC [58] DETAIL:  The database was created using collation version 2.36, but the operating system provides version 2.41.
db-1         | 2026-02-02 16:30:43.840 UTC [58] HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE sonar REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

Similar messages are cyclic printed for the databases ā€œtemplate1ā€ and ā€œpostgresā€.

I’m using PostgreSQL in version 15 as before. According to the documentation I think version 15 is still supported.

Here is my current docker compose file:

services:
  sonarqube:
    image: sonarqube:26.1.0.118079-community
    read_only: true
    depends_on:
      - db
    environment:
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: ***
      SONAR_JDBC_PASSWORD: ***
    volumes:
      - sonarqube_config:/opt/sonarqube/conf                     # configuration
      - sonarqube_data:/opt/sonarqube/data                       # runtime data software
      - sonarqube_extensions:/opt/sonarqube/extensions           # plugins
      - sonarqube_logs:/opt/sonarqube/logs                       # logfiles
      - sonarqube_temp:/opt/sonarqube/temp
    tmpfs:
      - /tmp:size=256M,mode=1777
    ports:
      - "127.0.0.1:9000:9000"                                    # available local only!
    restart: unless-stopped
  db:
    image: postgres:15
    environment:
      POSTGRES_USER: ***
      POSTGRES_PASSWORD: ***
      POSTGRES_DB: sonar
    volumes:
      - postgresql:/var/lib/postgresql                           # runtime data 1
      - postgresql_data:/var/lib/postgresql/data                 # runtime data 2
    ports:
      - "127.0.0.1:5432:5432"                                    # available local only!
    restart: unless-stopped

volumes:
  sonarqube_config:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_logs:
  sonarqube_temp:
  postgresql:
  postgresql_data:

Hi,

To be clear, you didn’t see these messages before the upgrade? They seem to be caused by the upgrade?

 
Thx,
Ann

It is not easy to answer.
It is true, that I’ve not seen such message before.
But, it also true, that I normally do not run the docker processes interactively (docker compose up). Normally I just start the processes in background (docker compose up -d). So, I’m not sure whether such message was written in the past.

1 Like

Hi,

Since we don’t know whether this was pre-existing, and since it sounds like a Postgres setup thing, rather than a sonar db thing I’m tempted to ask you to try the suggested change

However, I’ve routed this to the team to make sure we’re not going to blow something up. Altho I can’t say how long it will take them to show up.

 
Ann

Hello @lg2de

Most likely this is caused by underlying changes in the postgres:15 image. To avoid (or reduce the chance) this kind of issue in the future you might want to pin the version of postgres to something more specific, like postgres:15.5-bullseye (just a suggestion).

The solution suggested by @ganncamp is something that I would recommend too - otherwise you can’t be confident that your database correctly sorts data and therefore that related SonarQube instance works as it should.

Ideally, please back up your database before running this command (better safe than sorry!).

1 Like