postgres
arch
To upgrade the PostgreSQL database on Arch Linux, follow these steps. The steps are condensed fromthe Arch Linux Wiki.
sudo pacman -S postgresql-old-upgrade
sudo -iu postgres
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
cd /var/lib/postgres/tmp
initdb -D /var/lib/postgres/data
pg_upgrade -b /opt/pgsql-OLD_PG_VERSION/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data
exit
sudo systemctl start postgresql
sudo -iu postgres
cd /var/lib/postgres/tmp
/usr/bin/vacuumdb --all --analyze-in-stages
./delete_old_cluster.sh
exit
sudo rm -rf /var/lib/postgres/olddata
From: https://wiki.archlinux.org/title/PostgreSQL