postgresql,

How to fix 'type: geography does not exist' error in PostgreSQL

Feb 03, 2022 · 1 min read · Post a comment
How to fix 'type: geography does not exist' error in PostgreSQL

Restoring PostgreSQL databases could be sometimes tricky and most likely so include a few errors. In today’s issue resolving series, we are going to deal with the following error: type: "geography" does not exist.

Prerequisites

  • PostgreSQL

The cause

The error is related to PostGIS, which is basically an PostgreSQL extension that enables support for geographical objects. This usually occurs when dumping a db backup into a new empty database.

One of two scenarios comes to my mind:

  • The PostGIS extension is not installed.
  • The PostGIS extension is installed but not enabled.

The installation docs could be found in the PostGIS link above, so we are going to focus on the second one.

Solution

Step 1. Login to PostgreSQL.

psql

Step 2. Connect to the database.

\c dbName;

Step 3. Enable the PostGIS extension.

CREATE EXTENSION Postgis;

Conclusion

If you got any ideas, different approach or solution, let me know in the comments below.
On a side note, follow our official channel on Telegram.