PG17 volume incompatible with PG18 - need to force PG17 image or pg_upgrade

Production emergency - PostgreSQL service keeps deploying PG18 but my data volume was initialized with PG17. Getting fatal error: 'The data directory was initialized by PostgreSQL version 17, which is not compatible with this version 18.3'. Need to either force PG17 image to stick or run pg_upgrade. Site has been down 3+ hours. How do I fix this?

Solved

15 Replies

Try deploying a custom Postgres image with the 17 tag, then mount the volume onto it afterwards.


Alternatively, you can go into your Postgres service settings, set a custom deploy command for sleep infinity, then run the pg_upgrade command through SSH.


Getting further now with ghcr.io/railwayapp-templates/postgres-ssl:17 but hitting: 'unrecognized configuration parameter autovacuum_worker_slots in postgresql.conf line 687'. What specific 17.x version tag should I use, or how do I override that config parameter?


when I SHH in and try pg_upgrade I Gte "pg_upgrade: cannot be run as root

Failure, exiting

"


Okay here's what I'd try.


Set the custom command to sleep infinity.


i finally got it, my backup from the last restore point has been running over an hour. its 1.3 GB is that typical


Then, run sed -i 's/^[[:space:]]*autovacuum_worker_slots[[:space:]]*=/#&/' "${PGDATA}/postgresql.conf". (This would've commented out the PG18 config that broke PG17).


Oh. XD


Volume size? Or memory?


volume


Probably normal? It's a full backup IIRC.


yes full back up, after one hour stats whos only 8.5mb so far


shows only*


Solved the issues thank you


Status changed to Solved 0x5b62656e5d about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...