postgis not available for all postgres users

前端 未结 1 945
梦如初夏
梦如初夏 2021-01-24 11:56

When creating a new user on our Potgis enabled database I run into the strange issue that that new user cannot access the postgis extension while earlier created users can.

相关标签:
1条回答
  • 2021-01-24 12:24

    The PostGIS extension must be installed in a schema that must also be in the user search path.

    You can check where it is installed with the command

    select e.extname,n.* 
    from pg_extension e, pg_namespace n 
    where e.extnamespace = n.oid and e.extname='postgis';
    

    And you can check if the schema where it is installed is in the user search path by issuing

    show search_path;
    

    If not, you can permanently add the path by altering the user.

    ALTER USER username SET search_path TO "$user", public, postgis_schema;
    

    As the previous command takes effect at the next login only, you can apply it immediately by applying

    SET search_path TO "$user", public, postgis_schema;
    
    0 讨论(0)
提交回复
热议问题