ERROR: type "public.geometry" does not exist
ERROR: type "public.geometry" does not exist
我应该创建一个空间数据库并安装了 Postgres 并添加了 PostGIS 扩展。
当我尝试添加类型为 public.geometry
的列时,它总是给出
的错误消息
geometry type doesn't exist
我不熟悉 Postgres,也不知道解决方案可能是什么。我尝试 Google 但一无所获。
你 CREATE EXTENSION postgis;
了吗?在 psql
中检查 \dx
。
您是否将 PostGIS 扩展程序置于其他架构中?在 psql
.
中检查 \dT *.geometry
当您在目标数据库之外创建 postgis 扩展时,可能会发生这种情况,例如,您在未指定数据库的情况下登录到数据库服务器:
psql -h DB_HOST -U DB_USER
CREATE EXTENSION postgis;
\q
<apply dump here>
这件事发生在我身上。
修复:我需要从此 space 删除扩展,然后指定目标数据库,然后创建 postgis 扩展:
psql -h DB_HOST -U DB_USER DB_NAME
CREATE EXTENSION postgis;
\q
<apply dump here as DB_USER, onto DB_NAME>
我应该创建一个空间数据库并安装了 Postgres 并添加了 PostGIS 扩展。
当我尝试添加类型为 public.geometry
的列时,它总是给出
geometry type doesn't exist
我不熟悉 Postgres,也不知道解决方案可能是什么。我尝试 Google 但一无所获。
你 CREATE EXTENSION postgis;
了吗?在 psql
中检查 \dx
。
您是否将 PostGIS 扩展程序置于其他架构中?在 psql
.
\dT *.geometry
当您在目标数据库之外创建 postgis 扩展时,可能会发生这种情况,例如,您在未指定数据库的情况下登录到数据库服务器:
psql -h DB_HOST -U DB_USER
CREATE EXTENSION postgis;
\q
<apply dump here>
这件事发生在我身上。
修复:我需要从此 space 删除扩展,然后指定目标数据库,然后创建 postgis 扩展:
psql -h DB_HOST -U DB_USER DB_NAME
CREATE EXTENSION postgis;
\q
<apply dump here as DB_USER, onto DB_NAME>