This article is aimed at those like me who use Ubuntu and PostgreSQL to develop locally on their computer and after the last update to Ubuntu 21.04 th

pauloxnet – Upgrading PostgreSQL from version 12 to 13 on Ubuntu 21.04 (Hirsute Hippo)

submited by
Style Pass
2021-05-28 07:30:05

This article is aimed at those like me who use Ubuntu and PostgreSQL to develop locally on their computer and after the last update to Ubuntu 21.04 they have two versions of PostgreSQL installed.

The PostgreSQL version 12 is obsolete, but the server or client packages are still installed. Please install the latest packages (postgresql-13 and postgresql-client-13) and upgrade the existing clusters with pg_upgradecluster (see manpage).

Please be aware that the installation of postgresql-13 will automatically create a default cluster 13/main. If you want to upgrade the 12/main cluster, you need to remove the already existing 13 cluster (pg_dropcluster —stop 13 main, see manpage for details).

The old server and client packages are no longer supported. After the existing clusters are upgraded, the postgresql-12 and postgresql-client-12 packages should be removed.

There already is a cluster “main” for 13 (since this is created by default on package installation). This is done so that a fresh installation works out of the box without the need to create a cluster first, but of course it clashes when you try to upgrade 12/main when 13/main also exists. The recommended procedure is to remove the 13 cluster with pg_dropcluster and then upgrade with pg_upgradecluster.

Leave a Comment