Pg_upgrade
TIFU by letting pacman upgrade the postgresql a major version (13->14). Then the postgresql service failed to start.. Anyways here is the fix.
also a nice thing in the AUR: the postgresql-old-upgrade
package. It provides
the binary for the older version of psql under/opt/postgresql{VERSION}
Before doing anything stop the postgresql service.
mv /var/lib/postgres/data /var/lib/postgres/olddata
mkdir /var/lib/postgres/data /var/lib/postgres/tmp
chown postgres:postgres /var/lib/postgres/data /var/lib/postgres/tmp
# SWITCH TO postgres user: sudo -iu postgres
cd /var/lib/postgres/tmp
initdb -D /var/lib/postgres/data --PARAMETERS_USED_TO_INIT_DB
pg_upgrade -b /opt/pgsql-PG_VERSION/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data
Then start postgresql.service
again
Thank you, archwiki.
https://wiki.archlinux.org/title/PostgreSQL#Upgrading_PostgreSQL