Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update database collation version [beta, prod] #384

Open
mtracz opened this issue Jan 12, 2024 · 0 comments
Open

Update database collation version [beta, prod] #384

mtracz opened this issue Jan 12, 2024 · 0 comments
Labels
environment deployment, testing and other devops stuff

Comments

@mtracz
Copy link
Member

mtracz commented Jan 12, 2024

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

@mtracz mtracz added the environment deployment, testing and other devops stuff label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
environment deployment, testing and other devops stuff
Projects
None yet
Development

No branches or pull requests

1 participant