Search code examples
postgresqlpostgis

How to determine if postgis is enabled on a database?


I wanted to know if there is a way to determine that PostGis was enabled on a database.

I am trying to replicate my production server with my dev machine and I am not sure if the database on my dev machine had either PostGIS or postgis_topology enabled or both.

I tried looking around for a solution but could not come up with anything.
Any suggestions in this regard would be helpful.


Solution

  • Assuming that you have access to your database (either through the terminal or the pgadmin application), try the following:

    1. Connect to your database
    2. Run one (or both in order if you like) of the following queries:

      SELECT PostGIS_version();
      SELECT PostGIS_full_version();
      

    if no error occurs, then you have PostGIS enabled for that database.


    References: