I was running postgres 8.4 on arch but now have 9 installed I want to use pg_upgrade to upgrade but I don't know what all the options I have to use are, and all the directories that I have to point it to. it asks for a previous pg binary directory... but that's gone. Will it still work? note: I've no important data, just play db's I just want to know how to do it.
That's one of the problems with using Postgres on Arch: upon upgrade it won't change the file format automatically.
I usually just do database dump and restore as upgrade procedure. (you should have database dumps anyway as a backup...)
I'm sure you've read the documentation but just in case you haven't - "F.32. pg_upgrade".
The step-by-step instructions are especially detailed.
As a minumum you need to provide values for
--old-datadir
,--new-datadir
,--old-bindir
and--new-bindir
options.If your old installation is missing you could always (I hope so, I've never used Arch Linux) re-install it without overwriting the old data directory. If your distribution doesn't facilitate that you could re-install (temporarily) the old version from source.
Then you could run
pg_upgrade
. Remember to configure the two co-existing installations (the new one and the old one) to use different ports. And also set (temporarily) the local access method for both to "trust".Old question, but in case someone faces the same issue, I'm writing an answer.
Just yesterday, my postgresql was upgraded to 14.2 and I had 13.6 before. Upgrading removes the old directories so there's no way to run
pg_upgrade
. I got one package from AUR, but that replaces the existing binaries as well.But fortunately, archlinux now provides the package
postgresql-old-upgrade
. It contains the last version of postgresql. Install it just with pacman:And you can now upgrade your old database normally:
Directories and versions might differ for you, but in general that's how it worked for me.