【问题标题】:Postgres Osm2pgsql Error: role does not existPostgres Osm2pgsql 错误:角色不存在
【发布时间】:2011-11-04 01:00:55
【问题描述】:

我一直在设置 osm2pgsql 以将 .osm 文件转换为可在 Postgres 中使用。 我现在尝试了以下语句:

osm2pgsql --merc -d sa sa.osm

我收到以下错误: “与数据库的连接失败:致命:角色“myUsername”不存在

我已经阅读了使用 Postgres 时通常会遇到的这种错误。我在 Postgres 中创建了一个新角色,但错误仍然存​​在。

有什么建议吗?

【问题讨论】:

    标签: postgresql openstreetmap


    【解决方案1】:

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

    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)
    

    【讨论】:

      【解决方案2】:

      我知道这是一个老问题,但 OSM 中的情况发生了变化,这个答案似乎在 Google 搜索的顶部

      使用这个:

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

      例如

      /usr/bin/install-postgis-osm-user.sh gis barrythefish
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-12-20
        • 2017-09-02
        • 2019-12-29
        • 2021-10-11
        • 2023-01-26
        • 2020-03-04
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多