Collation Version issue

yusuf-ishaku
HOBBY

a month ago

hey how can I fix this guys?

The database was created using collation version 2.36, but the operating system provides version 2.41.

2025-08-28 15:55:58.931 UTC [668] HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE railway REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

$10 Bounty

8 Replies

Railway
BOT

a month ago


a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 26 days ago


a month ago

Hey, according to the Postgres docs, you would want to reindex and update the collation version of your Postgres database. This can be done by running REINDEX DATABASE railway; and ALTER DATABASE railway REFRESH COLLATION VERSION;. Make sure to backup your database before executing these queries, in case they fail and somehow corrupt the database. Having a backup also allows you to just deploy a new Postgres database and restore the backup to it, this way you have multiple ways to restore your database as opposed to just the one I mentioned first.


nelsoncf
PRO

19 days ago

I'm having the same issue. No matter how many times I try, I keep receiving this error.

Also, when I run, it returns:

NOTICE:  version has not changed

ALTER DATABASE

not sure what to do


fra
HOBBYTop 5% Contributor

19 days ago

I've fixed it on my db running these queries (after a backup):

ALTER DATABASE your-db-name REFRESH COLLATION VERSION;

REINDEX DATABASE your-db-name

I'm not a db admin, my db was almost empty and it wasn't in prod so I didn't care to break it, I'm not sure if this is the right way but it might be an input for you to do your own research and proceed based on your finding (I do not take any responsibility)....in any case remember to do a backup

One thing that happened to me is that I had to run this command in both my db (I'm not using the default db created by railway), the railway db and the postgres db as well, so maybe check the logs if the error you are getting is for the postgres db


nelsoncf

I'm having the same issue. No matter how many times I try, I keep receiving this error.Also, when I run, it returns:NOTICE:  version has not changedALTER DATABASEnot sure what to do

19 days ago

Have you tried to restore a backup to a new postgres database as suggested by me above as a fallback approach?


uxuz

Hey, according to the Postgres docs, you would want to reindex and update the collation version of your Postgres database. This can be done by running REINDEX DATABASE railway; and ALTER DATABASE railway REFRESH COLLATION VERSION;. Make sure to backup your database before executing these queries, in case they fail and somehow corrupt the database. Having a backup also allows you to just deploy a new Postgres database and restore the backup to it, this way you have multiple ways to restore your database as opposed to just the one I mentioned first.

fra
HOBBYTop 5% Contributor

18 days ago

Should the order of the queries be swapped?


fra

Should the order of the queries be swapped?

18 days ago

This shouldn't be the case according to the Postgres documentation that I have linked.

[...] When this happens, all objects depending on the collation should be rebuilt, for example, using REINDEX. When that is done, the collation version can be refreshed using the command ALTER COLLATION ... REFRESH VERSION. This will update the system catalog to record the current collation version and will make the warning go away. Note that this does not actually check whether all affected objects have been rebuilt correctly.


fra
HOBBYTop 5% Contributor

18 days ago

Mmm interesting , so I did it wrong but it still worked


Collation Version issue - Railway Help Station