Sharing issues on upgrading postgres data (postgres 12->13)

I’ve made sys upgrade (-Syu) & my postgre installation did upgrade 12.5 -> 13
I’ve didn’t notice it, but nevermind - in the service status was link on upgrading also db data:
It all went well, until the pg_upgrade command:
pg_upgrade -b /opt/pgsql-12/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data
But wait, there was no /opt/pgsql-12/ directory - it should be executables to old version postgres
I couldn’t find anything on this topic, even on arch forums, etc…
So I was trying to downgrade & use that binaries:
sudo pacman -U /var/cache/pacman/pkg/postgresql-12.5-3-x86_64.pkg.tar.zst
sudo cp $(pacman -Ql postgresql | egrep '/usr/bin/.+' | cut -d' ' -f2) /opt/pgsql-12/bin/
but there was another problem with some other files missing (some bin dependencies…), so I wanted rather to “install” that cache package to opt (it would be also cleaner solution), so I did:
sudo pacman -U -r /opt /var/cache/pacman/pkg/postgresql-12.5-3-x86_64.pkg.tar.zst
to install it under the /opt “root” directory. But what the hell - there were some pacman libraries missing (libalpm or whatever), so I just copied some files from /usr:
sudo cp -r /var/lib/pacman /opt/var/lib/
& then it went “well”, so now I have old postgres installed under: /opt/usr/
after that the pg_upgrade went also well:
pg_upgrade -b /opt/usr/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data
but this was really pain in the ass if you want just update database and I think it’s not very clean solution (now I have some trash in /opt directory and you never know if you didn’t forget to delete something & I dodn’t even know if pacman is in “good state”)
My question here is: how to make this properly & why there’s no /opt/pgsql-12/ directory as suggested in arch doc? (is this some special manjaro thing? - then why this isn’t in any doc? - I haven’t find anything on this topic anywhere…)


Install the postgresql-old-upgrade package which will create the /opt/pgsql-12/ directory and follow the arch wiki.
pg_upgrade -b /opt/pgsql-*PG_VERSION*/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data