Get PostGIS version

PostgresqlPostgis

Postgresql Problem Overview


How can I find out which version of PostGIS I have?

Postgresql Solutions


Solution 1 - Postgresql

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();

Solution 2 - Postgresql

Did you try using SELECT PostGIS_version();

Solution 3 - Postgresql

PostGIS_Lib_Version(); - returns the version number of the PostGIS library.

http://postgis.refractions.net/docs/PostGIS_Lib_Version.html

Solution 4 - Postgresql

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.

Solution 5 - Postgresql

Other way to get the minor version is:

SELECT extversion
FROM pg_catalog.pg_extension
WHERE extname='postgis'

Solution 6 - Postgresql

Using: SELECT PostGIS_full_version();

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJason SwettView Question on Stackoverflow
Solution 1 - PostgresqlNicklas AvénView Answer on Stackoverflow
Solution 2 - PostgresqlJon ConleyView Answer on Stackoverflow
Solution 3 - PostgresqltinoView Answer on Stackoverflow
Solution 4 - PostgresqlPete ClarkView Answer on Stackoverflow
Solution 5 - PostgresqlMatias BaroneView Answer on Stackoverflow
Solution 6 - PostgresqlViettel SolutionsView Answer on Stackoverflow