2011-08-25 80 views
3

我一直在设置osm2pgsql来将.osm文件转换为可在Postgres中使用。 我现在已经尝试了以下声明:Postgres Osm2pgsql错误:角色不存在

osm2pgsql --merc -d SA sa.osm

我提示以下错误: “连接到数据库失败:FATAL:角色‘名为myUsername’不存在

我对这种错误通常是运行使用Postgres的时候,我已经创造了Postgres的一个新的角色,但仍是错误持续到阅读起来。

有什么建议?

回答

9

您没有指定-U|--username开关,所以osm2pgsql从终端获取当前用户名(除非您设置了PGUSER环境变量)。错误消息看起来非常清楚,告诉您名为myUsername的角色不存在于您的数据库cluser中。需要注意的是:

CREATE ROLE myUsername LOGIN; -- creating role myusername 
CREATE ROLE "myUsername" LOGIN; -- creating role myUsername 

将产生两个不同角色:

SELECT rolname FROM pg_roles; 
    rolname 
------------ 
postgres 
myUsername 
myusername 
(3 rows) 
+0

谢谢!用户名开关起作用! – nix

1

我知道这是一个老问题,但事情已经在OSM改变,这个答案似乎是在谷歌的顶部搜索

使用此:

/usr/bin/install-postgis-osm-user.sh the-database-here your-username-here 

为例

/usr/bin/install-postgis-osm-user.sh gis barrythefish 
相关问题