[GIS] Why isn’t StackBuilder installation of PostGIS working

installationpostgis

I've installed PostGIS (ver. 2.0.1) on my Mac using EnterpriseDB's StackBuilder, which I also used for my PostgreSQL (9.2.2) installation. Although StackBuilder says that PostGIS is now installed, and although I have a PostGIS directory in /usr/local/PostgreSQL/9.2/, it doesn't appear to be actually installed (see queries below).

gregory=# select postgis_full_version();
ERROR:  function postgis_full_version() does not exist
LINE 1: select postgis_full_version();
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

gregory=# create extension postgis;
ERROR:  could not open extension control file "/usr/local/PostgreSQL/9.2/share/postgresql/extension/postgis.control": No such file or directory

and select * from pg_available_extensions; does not return a record for PostGIS.

Does anyone know what's up with this and how to get it to work?

Best Answer

I think you need to load the postgis extension to your database like

CREATE EXTENSION postgis

or load these files to your query window and run them in database

windows default: 
\Program files\Postgresql\8.4\share\contrib\postgis-2.0

postgis.sql
rtpostgis.sql
spatial_ref_sys.sql
topology.sql (if you want topology support)
Related Question