尝试为postgis创建模板数据库postgresql时出现问题

时间:2012-09-13 22:29:46

标签: postgis postgresql-9.1

我正在使用ubuntu 12.04,我安装了postgis2.1和postgresql9.1 ......我是所有人的新手!... 我按照这个tuto来创建一个模板数据库: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

(如tuto中所示)机器返回

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

2 个答案:

答案 0 :(得分:3)

在Postgres 9.1中有a new way来创建空间数据库:

psql -d template_postgis2 -c "CREATE EXTENSION postgis;"

答案 1 :(得分:0)

刚刚在某个论坛上找到:

sudo ldconfig

更新: 在official documentation中找到了此建议:

  

在Linux平台上,可能需要在安装每个库后运行ldconfig命令。

修复了从postgis模板创建数据库时可能出现的postres错误

相关问题