Postgis is easily installed from apt. Depending on which version of Ubuntu you are using, and which repositories you have configured, these commands will install PostGIS 1.5, or 2. x. You can find the version installed by issuing a select PostGIS_full_version(); query with psql or another tool.
PostGIS 3.2. 2 came out Jul 23, 2022.
The latest release version now comes packaged with the PostgreSQL DBMS installs as an optional add-on. As of this writing PostGIS 3.1. 4 is the latest stable release and PostGIS 3.2.
Since some of the functions depend on other libraries like GEOS and proj4 you might want to get their versions too. Then use:
SELECT PostGIS_full_version();
Did you try using SELECT PostGIS_version();
PostGIS_Lib_Version();
- returns the version number of the PostGIS library.
http://postgis.refractions.net/docs/PostGIS_Lib_Version.html
As the above people stated, select PostGIS_full_version(); will answer your question. On my machine, where I'm running PostGIS 2.0 from trunk, I get the following output:
postgres=# select PostGIS_full_version();
postgis_full_version
-------------------------------------------------------------------------------------------------------------------------------------------------------
POSTGIS="2.0.0alpha4SVN" GEOS="3.3.2-CAPI-1.7.2" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.8.1, released 2011/07/09" LIBXML="2.7.3" USE_STATS
(1 row)
You do need to care about the versions of PROJ and GEOS that are included if you didn't install an all-inclusive package - in particular, there's some brokenness in GEOS prior to 3.3.2 (as noted in the postgis 2.0 manual) in dealing with geometry validity.
Other way to get the minor version is:
SELECT extversion
FROM pg_catalog.pg_extension
WHERE extname='postgis'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With