Upgrading PostGIS v3
These examples show upgrading for RHEL/CentOS 7 platforms:
- Example 1: Upgrading from PostGIS version 3.1 to 3.2
- Example 2: Upgrading from PostGIS versions 2.5 or later to 3.1.4 on the same EDB Postgres Advanced Server version
- Example 3: Upgrading from PostGIS versions earlier than 2.5 to 3.1.4 on a different EDB Postgres Advanced Server version
Example 1: Upgrading from PostGIS version 3.1 to 3.2
This example upgrades from PostGIS version 3.1 to version 3.2 for EDB Postgres Advanced Server 14.
To avoid accidental upgrades, PostGIS versions 3.1 and 3.2 use different package names. So, upgrading to version 3.2 requires that you first uninstall version 3.1. After you install version 3.2, you can upgrade the PostGIS extensions.
If you haven't already, create the PostGIS extensions in PostGIS version 3.1. For instructions, see Creating extensions.
Uninstall PostGIS version 3.1.
For EDB Posgres Advanced Server version 14:
For earlier versions of EDB Postgres Advanced Server:
Where
<xx>
is the version of EDB Postgres Advanced Server.For more information, see Uninstalling PostGIS.
Install PostGIS version 3.2. For instructions, see Installing PostGIS.
Upgrade the PostGIS extensions:
Note
If you first upgraded from a PostGIS version earlier than 2.5 to PostGIS version 3.1, then you must
DROP
thepostgis_raster extension
before executing the command.
Example 2: Upgrading from PostGIS versions 2.5 or later to 3.1.4 on the same EDB Postgres Advanced Server version
This example upgrades from PostGIS version 2.5.5 to PostGIS version 3.1.4 for EDB Postgres Advanced Server version 12.
Note
It's assumed that you already created extensions for PostGIS version 2.5.5 as described in Creating extensions and that the EDB Advanced Server 12 service is running.
To upgrade PostGIS version 2.5.5 to PostGIS version 3.1.4 for EDB Postgres Advanced Server 12, assume superuser privileges and invoke:
To update extensions, switch to the enterprisedb user, connect to the database where you already created extensions with the psql client application, and invoke:
Example 3: Upgrading from PostGIS versions earlier than 2.5 to 3.1.4 on a different EDB Postgres Advanced Server version
This example upgrades PostGIS version 2.4.6 for EDB Postgres Advanced Server 10 to PostGIS version 3.1.4 for EDB Postgres Advanced Server version 14:
Step 1 — Upgrade to PostGIS 3.1.1. This is an intermediate step required to resolve dependency issues.
Step 2 — Upgrade to PostGIS 3.1.4.
Step 3 — Upgrade EDB Postgres Advanced Server version 10 to 14.
Note
It's assumed that you already created extensions for the PostGIS version earlier than 2.5.5, as described in Creating extensions, and EDB Advanced Server 10 service is running.
When the PostGIS data has a dependency on the raster functions, upgrading to PostGIS version 3.1.4 requires dumping and reloading the data.
Step 1 — To upgrade PostGIS version 2.4.6 to 3.1.4, you need to upgrade it to 3.1.1 first:
Navigate to the bin directory of EDB Advanced Server 10:
Assume superuser privileges and upgrade to PostGIS version 3.1.1:
Note
See the Installing PostGIS on a Debian/Ubuntu Host section for information about Debian platform commands.
To update extensions, switch to the enterprisedb user, connect to the database where you already created extensions with the psql client application, and execute the following commands:
Step 2 — Upgrade to PostGIS version 3.1.4:
To upgrade PostGIS version 3.1.1 to 3.1.4, invoke the following command for EDB Postgres Advanced Server 10:
To update extensions, switch to the enterprisedb user and invoke:
With PostGIS version 3.1.4, the return type of the raster functions has changed, which requires dropping and creating the raster extension as part of the upgrade process.
Quit and reopen the psql client session:
Step 3 — Upgrade EDB Postgres Advanced Server version 10 to 14:
Assume superuser privileges and stop the EDB Postgres Advanced Server 10 service:
Install the EDB Postgres Advanced Server version 14:
Navigate to the
/bin
directory of EDB Advanced Server 14 and initialize the cluster:Install PostGIS version 3.1.4 for EDB Postgres Advanced Server version 14.0:
Assume superuser privileges and stop the EDB Postgres Advanced Server 14.0 service:
Switch to the enterprisedb user and create a
temp
folder:Check cluster compatibility and consistency and perform the upgrade:
Assume superuser privileges, navigate to the
bin
directory of EDB Postgres Advanced Server 14, and start the service:To update extensions, switch to the enterprisedb user, connect to the database where you already created extensions with the psql client application, and execute the following commands: