Upgrading PostGIS v1.0

Edit this page

You can upgrade PostGIS for the same Advanced Server branch and the different Advanced server branches.

The following example walks you through upgrading PostGIS from 2.5.4 to 3.0.2 of the same Advanced Server branch 11:

  1. Install PostGIS 3.0.2.

  2. To update extensions, connect to the database (where you have already added extensions) with the psql client application, and execute the following commands:

    edb=# alter extension postgis update TO “3.0.2”;
    WARNING:  unpackaging raster
    WARNING:  PostGIS Raster functionality has been unpackaged
    HINT:  type `SELECT postgis_extensions_upgrade(); to finish the upgrade. After upgrading, if you want to drop raster, run: DROP EXTENSION postgis_raster;
    ALTER EXTENSION
    edb=# SELECT postgis_extensions_upgrade();
    NOTICE:  Packaging extension postgis_raster
    NOTICE:  Updating extension postgis_topology from 2.5.4 to 3.0.2
    NOTICE:  Updating extension postgis_tiger_geocoder from 2.5.4 to 3.0.2
                        postgis_extensions_upgrade
    -------------------------------------------------------------------
     Upgrade completed, run SELECT postgis_full_version(); for details
    (1 row)

The following example walks you through upgrading PostGIS from 2.5.4 for Advanced server 11 to 3.0.2 for Advanced server 12:

  1. Stop the EDB Postgres Advanced Server 11 server service:

    systemctl stop edb-as-11
  2. Assume the superuser privileges and install the EDB Postgres Advanced Server 12 server:

    yum install edb-as12-server
  3. Navigate to the bin directory and initialize the cluster:

    ./edb-as-12-setup initdb
  4. Change the pg_hba.conf file authentication setting to trust (these should be reversed after compatibility check). For more information about modifying the pg_hba.conf file, see the PostgreSQL core documentation available at PostgreSQL website.

    vi /var/lib/edb/as12/data/pg_hba.conf
    # "local" is for Unix domain socket connections only
    
    local   all    all                trust
    
    # IPv4 local connections:
    
    host    all    all  127.0.0.1/32  trust
  5. Install the PostGIS package:

    yum install edb-as12-postgis-2.5.4
  6. Set appropriate permissions to the /tmp directory:

    chmod 777 /tmp
  7. Change the current directory to tmp and switch to an enterprisedb user:

    cd /tmp
    
    su enterprisedb
  8. Execute the following command to upgrade to EDB Postgres Advanced Server 12:

    /usr/edb/as12/bin/pg_upgrade -d /var/lib/edb/as11/data/ -D /var/lib/edb/as12/data/ -U enterprisedb -b /usr/edb/as11/bin/ -B /usr/edb/as12/bin/ -p 5444 -P 5445 -c
    
    /usr/edb/as12/bin/pg_upgrade -d /var/lib/edb/as11/data/ -D /var/lib/edb/as12/data/ -U enterprisedb -b /usr/edb/as11/bin/ -B /usr/edb/as12/bin/ -p 5444 -P 5445 --link
  9. Execute the following command to upgrade to PostGIS 3.0.2 for Advanced Server version 12:

    yum upgrade edb-as12-postgis* -y
  10. To update extensions, connect to the database (where you have already added extensions) with the psql client application, and execute the following commands:

    edb=# alter extension postgis update to '3.0.2';
    WARNING: unpackaging raster
    WARNING: PostGIS Raster functionality has been unpackaged
    HINT: type `SELECT postgis_extensions_upgrade(); to finish the upgrade. After upgrading, if you want to drop raster, run: DROP EXTENSION postgis_raster;
    ALTER EXTENSION
    edb=# SELECT PostGIS_Extensions_Upgrade();
    NOTICE: Packaging extension postgis_raster
    NOTICE: Updating extension postgis_topology from 2.5.4 to 3.0.2
    NOTICE: Updating extension postgis_tiger_geocoder from 2.5.4 to 3.0.2
    postgis_extensions_upgrade
    -------------------------------------------------------------------
    Upgrade completed, run SELECT postgis_full_version(); for details
    (1 row)
    edb=# SELECT postgis_full_version();
                                    postgis_full_version
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    POSTGIS="3.0.2 2fb2a18" [EXTENSION] PGSQL="120" GEOS="3.8.1-CAPI-1.13.3" PROJ="7.1.1" GDAL="GDAL 3.1.3, released 2020/09/01" LIBXML="2.9.1" LIBJSON="0.11" TOPOLOGY RASTER
    (1 row)