How to Upgrade PostgreSQL 10 Cluster to 12 in Ubuntu 20.04
W hen I upgraded my Ubuntu 18.04 to 20.04, the PostgreSQL package also got upgraded from version 10 to 12. The upgrade said in order to remove the v10 I have to migrate the clusters first. This is how I migrate the v10 cluster to v12 cluster. To begin with, Postgre has this pg_upgrade command. Here is the link to the documentation. The syntax is as follows: pg_upgrade -b oldbindir -B newbindir -d oldconfigdir -D newconfigdir [ option ...] It is in /usr/lib/postgresql/<version>/bin/ directory . But when I ran this command in my user context, I got Permission Denied. It also forbids running as sudo either. The only way that makes sense now is running this command in postgres user context. Please note that I use the --check flag below to avoid running the real migration. And don't forget to stop the postgresql service before. chris@focal : ~ $ sudo systemctl stop postgresql chris@focal : ~ $ sudo su - postgres postgres@focal : ~ $ /usr/lib/postgresql/12/bin/pg_upgra...