我使用的是 ubuntu 12.04,我安装了 postgis2.1 和 postgresql9.1...而且我是新手!... 我按照这个教程创建一个模板数据库:http://linfiniti.com/2012/05/installing-postgis-2-0-on-ubuntu/我被困住了,不知道现在该怎么办......
当我尝试执行以下命令时:
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.0/postgis.sql
我有以下错误(我只复制粘贴末尾,因为对于不同的行号来说这是相同的错误):
psql:/usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql:6050: ERROR: current transaction is aborted, commands ignored until end of transaction block psql:/usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql:6056: ERROR: current transaction is aborted, commands ignored until end of transaction block ROLLBACK
我注意到每个错误都链接到我执行的脚本 postgis.sql 中以“LANGUAGE....”开头的命令 我在互联网上看到这种错误可能是由于未安装 plpgsql 造成的,但自从我输入以下内容以来,这不是我的情况:
createlang -d template_postgis2 plpgsql
(如教程中给出的)机器返回
createlang: language "plpgsql" is already installed in database "template_postgis2"
有人知道发生了什么事吗?和/或我应该做什么? 也许因为我使用的是 postgis2.1 而不是 2.0,就像教程 linfinity.com 中那样,它会把事情搞砸?
编辑:错误消息的开头如下:
$ psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql SET BEGIN psql:/usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql:47: ERROR: permission denied for language c psql:/usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql:52: ERROR: current transaction is aborted, commands ignored until end of transaction block
最佳答案
有a new way在 Postgres 9.1 中创建空间数据库:
psql -d template_postgis2 -c "CREATE EXTENSION postgis;"
关于postgis - 尝试为 postgis 创建模板数据库 postgresql 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12415693/