PostGIS Error – Type “geography” Does Not Exist

postgispostgresql

I just upgraded my development machine to Windows 7 and am therefore reinstalling PostgreSQL and PostGIS. I used the Postgres Plus installer, as recommended on the Postgres website, and followed this tutorial for installation. I created a database using the template_postgis and the application that I am currently developing was able to connect to the database with no problems.

However, my old code is not able to create tables using the PostGIS Geography like it used to. For example, when I try to create the following table:

CREATE TABLE test_area (
    id SERIAL PRIMARY KEY,
    name VARCHAR(1000),
    area GEOGRAPHY(POLYGON, 4326),
    start_time DATE,
    end_time DATE
)

I get the following error:

ERROR:  type "geography" does not exist
LINE 4:         area GEOGRAPHY(POLYGON, 4326),
                     ^

If I look under the database in the Object brower of pgAdmin III, I see a bunch of Geometry functions, so the installation seems to have run correctly. I'm not sure what my problem might be. Is it possible for the installer to only install PostGIS Geometry, but not Geography?

Best Answer

As lovely as they are for developing / maintaining the one-click installer for Windows, EnterpriseDB makes it very easy to end up with their proprietary "Postgres Plus" software, which is not the community version and, unless you have a specific need for EnterpriseDB software, IT'S NOT WHAT YOU WANT.

It takes them time to port their add-ons to the latest versions and most of the additional components shipped with Postgres Plus (standard or advanced) are outdated. ALSO, they monkey with the file paths we reference so often when customizing our Postgres instances.

I suggest you thoroughly wipe your new system of all postgres plus or enterprise db components and start fresh with the installer found here:

http://www.enterprisedb.com/products-services-training/pgdownload#windows

Run this installer, selecting PostGIS from the Application Stack Builder, and you'll have the most recent, stable, community-supported versions of PostgreSQL and PostGIS.

I have nothing against the truly fine folks at EnterpriseDB, I just think they make it suspiciously easy for people looking for open-source software to end up installing their proprietary product.