I was going to update my postgresql from 10 to 12, using homebrew.
What I did:
brew uninstall postgresql@10
brew install postgresql@12
I got the server running after this with brew services (but stopped it before trying pg_upgrade).
Then comes the problem. I got a db in the directory /opt/homebrew/var/postgresql@10/
that I wanted to move to the new postgresql directory /opt/homebrew/var/postgresql@12/
.
So I used the command:
pg_upgrade -b /opt/homebrew/var/postgresql@10 -B /opt/homebrew/var/postgresql@12 -d /opt/homebrew/var/postgresql@10 -D /opt/homebrew/var/postgresql@12
which resulted in failure with the explanation:
check for "/opt/homebrew/var/postgresql@10/postgres" failed: No such file or directory Failure, exiting
There is no folder named "postgres" in that directory but I don't believe it should be reading the documentation, and looking at others' example of how pg_upgrade is used, like this gist for example.
There DO EXIST a directory on the path to a bunch of files and folders which seem to be the same as in the documentation link above.
I have scoured the web for someone having the same problem without any luck. Do someone know what this issue might be, or can help me troubleshoot it further?
Thanks
For the -b
and -B
options you have to supply the directories that contain the postgres
executable. Those are probably /opt/homebrew/var/postgresql@10/bin
and /opt/homebrew/var/postgresql@12/bin
.
Upgrading to v12 is a highly questionable idea, since that version will go out of support in 2024. Upgrade to the latest major release.