Knowledge Base

How to determine the PostgreSQL and PostGIS versions

This article describes how to determine which PostgreSQL and PostGIS versions are installed on a server.

Determining the PostgreSQL version

To determine which PostgreSQL version is installed on your server, log in to your account using SSH, and then type the following command at the command line:

psql --version

Alternatively, you can log in to PostgreSQL from the command line using the psql program, and then type the following query to view additional version information:

SELECT version();
Determining the PostGIS version

Your server may also have PostGIS installed. To determine the version installed on your server, log in to PostgreSQL from the command line using the psql program, and then type the following query:

SELECT PostGIS_full_version();

If PostGIS is installed, you see output that resembles the following (the exact version numbers may differ):

POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" 
GDAL="GDAL 1.9.1, released 2012/05/15 GDAL_DATA not found" LIBXML="2.7.6" TOPOLOGY RASTER
(1 row)

If PostGIS is not installed, however, you see output that resembles the following:

ERROR:  function postgis_full_version() does not exist
If you would like PostGIS installed on your server, please open a support ticket on the Customer Portal at https://my.a2hosting.com.