Skip to content

Update database collation version [beta, prod] #384

@mtracz

Description

@mtracz

During deploys we can see warning in the logs:

err: WARNING:  database "toby-prod" has a collation version mismatch
err: DETAIL:  The database was created using collation version 2.31, but the operating system provides version 2.36.
err: HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE "toby-prod" REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

Prod:

Beta:

This happen probably after upgrade PostgreSQL database to the newer version. (It's doing automatically, because we have set image: postgres:15 in docker compose).


Possible solution:

  1. Backup
  2. Run manually on database server
REINDEX DATABASE <database name>;

ALTER DATABASE <database name> REFRESH COLLATION VERSION;

https://www.postgresql.org/docs/current/sql-altercollation.html#SQL-ALTERCOLLATION-NOTES


Additional steps:

We should lock postgreSQL version to prevent "silent updates"

Actually used version: 15.5-1.pgdg120+1 (for this moment)

Also we should consider to use pg_upgrade tool during switching major versions.
https://www.postgresql.org/docs/15/pgupgrade.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    environmentdeployment, testing and other devops stuff

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions