pythonpostgresqlupgradepg-upgrade

Issue in postgres upgrade from 11.1 to 11.6 using pg_upgrade


I'm trying to upgrade from one minor version (11.1) to another minor version (11.6) using the pg_upgrade tool but it is failing in the below command:

su - postgres -c '/usr/pgsql-11/bin/pg_upgrade -d /opt/collabnet/teamforge/var/pgsql/11.1/data -D /opt/collabnet/teamforge/var/pgsql/11.6/data -b /usr/pgsql-11/bin -B /usr/pgsql-11/bin'

with below error:

Performing Consistency Checks

Checking cluster versions                                   ok

Cannot upgrade to/from the same system catalog version when
using tablespaces.
Failure, exiting

and this below error in postgresql.log file:

could not open directory "pg_tblspc/16400/PG_11_201809051": No such file or directory

Any ideas about how to overcome it with the same pg_upgrade tool?

pg_upgrade_server.log

could not open directory "pg_tblspc/16400/PG_11_201809051": No such file or directory

Solution

  • You don't use pg_upgrade for a minor upgrade.

    Just stop the server, replace the 11.1 binaries with the 11.6 ones (you should actually be using 11.7) and start the server. By “replacing the binaries” I mean that you should install the 11.6 release of PostgreSQL in the same directories as the 11.1 release, thereby overwriting the previous installation.

    That is all! You should also read the release notes, sometimes some additional fixes in the database metadata are necessary.

    The error you encounter is because you are using tablespaces. In every tablespace, PostgreSQL creates a subdirectory whose name contains the catalog version. During pg_upgrade, a new such subdirectory is created in each tablespace. This of course cannot work if the catalog versions are the same.