Postgis installation: type “geometry” does not exi

2019-01-12 18:01发布

I am trying to create table with Postgis. I do it by this page. But when I import postgis.sql file, I get a lot of errors:

ERROR:  type "geometry" does not exist

Does anybody know how can I fix it?

9条回答
放荡不羁爱自由
2楼-- · 2019-01-12 18:53

You can do it from terminal:

psql mydatabasename -c "CREATE EXTENSION postgis";
查看更多
混吃等死
3楼-- · 2019-01-12 18:54

First make sure you have (matching to pg version: psql -V) postgis installed:

sudo apt install postgis postgresql-9.6-postgis-2.3

Just before tables creation add:

db.engine.execute('create extension postgis') 
db.create_all()
查看更多
淡お忘
4楼-- · 2019-01-12 18:56

I had the same problem, but it was fixed by running following code

CREATE EXTENSION postgis;

In detail,

  1. open pgAdmin
  2. select (click) your database
  3. click "SQL" icon on the bar
  4. run "CREATE EXTENSION postgis;" code
查看更多
登录 后发表回答