Upgrading the postgres database after warning message
jamesmparry87
HOBBYOP

a year ago

I have the following warning message constantly in my deployment logs – WARNING: database "railway" has a collation version mismatch

Following connecting to the database through the terminal and executing commands to upgrade or rebuild, the terminal reports no change in version, and the warning is not resolved.

Perhaps I am attempting to resolve this in an incorrect way?

I am working on Windows through GitBash.

Solved$10 Bounty

Pinned Solution

jamesmparry87
HOBBYOP

a year ago

Unfortunately that approach didn't work effectively, although it did lead me to trying the original ALTER DATABASE railway REFRESH COLLATION VERSION; command and it worked this time so at least the issue is resolved. Thank you for the support.

9 Replies

Railway
BOT

a year ago


jamesmparry87
HOBBYOP

a year ago

For reference, trying the previously mentioned command:

ALTER DATABASE railway REFRESH COLLATION VERSION;

REINDEX DATABASE railway;

Was unsuccessful


jamesmparry87

For reference, trying the previously mentioned command: ALTER DATABASE railway REFRESH COLLATION VERSION; REINDEX DATABASE railway; Was unsuccessful

a year ago

Hey, another approach that will certainly work, is to pg_dump your current database and restore it to a new one. This way you will have a new healthy database with all the data you previously had and ready to be used. The old one can then be deleted once you have updated your services to point to the new database.


jamesmparry87
HOBBYOP

a year ago

Do you have any docs for how to do that? Or is it a single command?


jamesmparry87

Do you have any docs for how to do that? Or is it a single command?

a year ago

Hey, it would be two commands you would have to execute, pg_dump to dump your database and pg_restore or psql (if you dump it as sql) to restore it. Dumping and restoring your database can be as easy as runningpg_dump '[DATABASE_URL_ORIGIN]' --no-owner --no-privileges > dump.sql and psql '[DATABASE_URL_DESTINATION]' -f dump.sql. Please follow the Railway blog for the installation of the required psql CLI.


a year ago

Hey jamesmparry87!

Did what uxuz provide help?


jamesmparry87
HOBBYOP

a year ago

Thanks uxuz, I'll give it a try and report back. It sounds a bit scary as it feels like something which would make you lose data, but since you specifically called out that I will have all the data I previously had it shouldn't be a problem. Fingers crossed


jamesmparry87
HOBBYOP

a year ago

Unfortunately that approach didn't work effectively, although it did lead me to trying the original ALTER DATABASE railway REFRESH COLLATION VERSION; command and it worked this time so at least the issue is resolved. Thank you for the support.


jamesmparry87

Unfortunately that approach didn't work effectively, although it did lead me to trying the original ALTER DATABASE railway REFRESH COLLATION VERSION; command and it worked this time so at least the issue is resolved. Thank you for the support.

a year ago

Hey, do you mind elaborating on why the backup and restore didn't work effectively?


Status changed to Solved uxuz 12 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...