Upgrading PostGIS 2.1.5 or 2.5.4
For SynxDB 2, you can upgrade from PostGIS 2.1.5 to 2.5.4, or from a PostGIS 2.5.4 package to a newer PostGIS 2.5.4 package.
- Upgrading from PostGIS 2.1.5 to the PostGIS 2.5.4 pivotal.3 (and later) Package
- Upgrade a PostGIS 2.5.4 Package from pivotal.1 or pivotal.2 to pivotal.3 (and later)
- Checking the PostGIS Version
Note For SynxDB 2, you can upgrade from PostGIS 2.1.5 to 2.5.4, or from a PostGIS 2.5.4 package to a newer PostGIS 2.5.4 package using the
postgis_manager.sh
script described in the upgrade instructions.
Upgrading PostGIS using the postgis_manager.sh
script does not require you to remove PostGIS support and re-enable it.
Removing PostGIS support from a database drops PostGIS database objects from the database without warning. Users accessing PostGIS objects might interfere with the dropping of PostGIS objects. See the Notes section in Removing PostGIS Support.
Upgrading from PostGIS 2.1.5 to the PostGIS 2.5.4 pivotal.3 (and later) Package
A PostGIS 2.5.4 pivotal.3
(and later) package contains PostGIS 2.5.4. Also, the PostGIS 2.5.4 pivotal.3
(and later) package supports using the CREATE EXTENSION
command and the DROP EXTENSION
command to enable and remove PostGIS support in a database. See Notes.
After upgrading the SynxDB PostGIS package, you can remove the PostGIS 2.1.5 package (gppkg
) from the SynxDB system. See Removing the PostGIS 2.1.5 package.
-
Confirm you have a PostGIS 2.1.5 package such as
postgis-2.1.5+pivotal.1
installed in a SynxDB system. See Checking the PostGIS Version. -
Install the PostGIS 2.5.4 package into the SynxDB system with the
gppkg
utility.gppkg -i postgis-2.5.4+pivotal.3.build.1-gp6-rhel7-x86_64.gppkg
Run the
gppkg -q --all
command to verify the updated package version is installed in the SynxDB system. -
For all databases with PostGIS enabled, run the PostGIS 2.5.4
postgis_manager.sh
script in the directory$GPHOME/share/postgresql/contrib/postgis-2.5
to upgrade PostGIS in that database. This command upgrades PostGIS that is enabled in the databasemytest
in the SynxDB system.$GPHOME/share/postgresql/contrib/postgis-2.5/postgis_manager.sh mytest upgrade
-
After running the script, you can verify that PostGIS 2.5.4 is installed and enabled as an extension in a database with this query.
# SELECT * FROM pg_available_extensions WHERE name = 'postgis' ;
-
You can validate that PostGIS 2.5 is enabled in the database with the
postgis_version()
function.
After you have completed the upgrade to PostGIS 2.5.4 pivotal.3
or later for the SynxDB system and all the databases with PostGIS enabled, you enable PostGIS in a new database with the CREATE EXTENSION postgis
command. To remove PostGIS support, use the DROP EXTENSION postgis CASCADE
command.
Removing the PostGIS 2.1.5 package
After upgrading the databases in the SynxDB system, you can remove the PostGIS 2.1.5 package from the system. This command removes the postgis-2.1.5+pivotal.2
package from a SynxDB system.
gppkg -r postgis-2.1.5+pivotal.2
Run the gppkg -q --all
command to list the installed SynxDB packages.
Upgrade a PostGIS 2.5.4 Package from pivotal.1 or pivotal.2 to pivotal.3 (or later)
You can upgrade the installed PostGIS 2.5.4 package from pivotal.1
or pivotal.2
to pivotal.3
or later (a minor release upgrade). The upgrade updates the PostGIS 2.5.4 package to the minor release (pivotal.3
\ or later) that uses the same PostGIS version (2.5.4).
The pivotal.3
minor release and later support using the CREATE EXTENSION
command and the DROP EXTENSION
command to enable and remove PostGIS support in a database. See Notes.
-
Confirm you have a PostGIS 2.5.4 package
postgis-2.5.4+**pivotal.1**
orpostgis-2.5.4+**pivotal.2**
installed in a SynxDB system. See Checking the PostGIS Version. -
Upgrade the PostGIS package in the SynxDB system using the
gppkg
option-u
. The following command updates the package to thepostgis-2.5.4+pivotal.3.build.1
package.gppkg -u postgis-2.5.4+pivotal.3.build.1-gp6-rhel7-x86_64.gppkg
-
Run the
gppkg -q --all
command to verify the updated package version is installed in the SynxDB system. -
For all databases with PostGIS enabled, upgrade PostGIS with the PostGIS 2.5.4
postgis_manager.sh
script that is in the directory$GPHOME/share/postgresql/contrib/postgis-2.5
to upgrade PostGIS in that database. This command upgrades PostGIS that is enabled in the databasemytest
in the SynxDB system.$GPHOME/share/postgresql/contrib/postgis-2.5/postgis_manager.sh mytest upgrade
After you have completed the upgrade to PostGIS 2.5.4 pivotal.3
or later for the SynxDB system and all the databases with PostGIS enabled, you enable PostGIS in a new database with the CREATE EXTENSION postgis
command. To remove PostGIS support, use the DROP EXTENSION postgis CASCADE
command.
Checking the PostGIS Version
When upgrading PostGIS you must check the version of the SynxDB PostGIS package installed on the SynxDB system and the version of PostGIS enabled in the database.
-
Check the installed PostGIS package version with the
gppkg
utility. This command lists all installed SynxDB packages.gppkg -q --all
-
Check the enabled PostGIS version in a database with the
postgis_version()
function. Thispsql
command displays the version PostGIS that is enabled for the databasetestdb
.psql -d testdb -c 'select postgis_version();'
If PostGIS is not enabled for the database, SynxDB returns a
function does not exist
error. -
For the SynxDB PostGIS package
postgis-2.5.4+pivotal.2
and later, you can display the PostGIS extension version and state in a database with this query.# SELECT * FROM pg_available_extensions WHERE name = 'postgis' ;
The query displays the version whether the extension is installed and enabled in a database. If the PostGIS package is not installed, no rows are returned.
Notes
Starting with the SynxDB postgis-2.5.4+pivotal.2
package, you enable support for PostGIS in a database with the CREATE EXTENSION
command. For previous PostGIS 2.5.4 packages and all PostGIS 2.1.5 packages, you use an SQL script.