Search code examples
postgresqlpostgis

Postgresql + POSTGIS


I'm trying to deploy PostgreSQL + PostGIS for my ruby app. I follow this tutorial, but when I'm typing: CREATE EXTENSION PostGIS the terminal returns,

CREATE EXTENSION postgis;
CREATE : undefined command

my setup:

  • POSTGRESQL 10.4
  • Ruby 2.4.3
  • Rails 5.1.6

Solution

  • Where are you executing CREATE EXTENSION postgis? This command has to be executed in the database via a PostgreSQL client, such as psql or pgAdmin. What you're getting is an error message from your console, which does not know this command.

    Try this from your console:

    psql -d yourdatabase -c "CREATE EXTENSION postgis"
    

    Check the psql documentation for more details on how to connect to the database.