Looking an upgrade plan for posgreSQL 9.3/postgis 2.1 to latest possible versions

I am currently using PostgreSQL 9.3/PostGIS2.1. I want to upgrade to PG13. Could we able to upgrade to 13.x directly? Any help is appreciated.

1 Like

Hi @ja2027 , Yes you can upgrade to any latest version of PostgreSQL using pg_upgrade directly. The relevant version of extensions (including PostGIS) on the new PostgreSQL version must be installed prior to the migration.

1 Like

Hello @ja2027, As @Jobin_Augustine Jobin said you can upgrade your PostgreSQL cluster using pg_upgrade directly, however, it will be possible only if you are ok with dropping the Postgis extension and recreating it after the upgrade.
But if dropping and re-creating the Postgis is not an option for you, then I would suggest you to following the below upgrade path.

  1. At first, upgrade your Postgis extension from Postgis 2.1 to Postgis 2.4.
  2. The next step will be to upgrade your PostgreSQL cluster from 9.3 to PostgreSQL 11.
  3. Then again upgrade your Postgis from 2.4 to Postgis 3.1 / 3.2.
  4. And, finally now you can upgrade your PostgreSQL from PostgreSQL 11 to PostgreSQL 13 version.

The above upgrade path needs to be followed because Postgis 2.1 is not supported on PostgreSQL 13 version and a direct upgrade with an extension present on the database will result in an error.
The support Matrix of the Postgis version and PostgreSQL version can be found over the below link.

[Support Matrix Postgis and PostgreSQL ]

1 Like