pg_dump: [archiver (db)] query failed: ERROR: permission denied for relation abouts

后端 未结 3 1989
清酒与你
清酒与你 2021-01-17 09:58

I\'m trying to dump my pg db but got these errors please suggest

pg_dump: [archiver (db)] query failed: ERROR:  permission denied for relation abouts
pg_dump         


        
相关标签:
3条回答
  • 2021-01-17 10:17

    Change the permission to the user: login as sudo user by using following cmd

    sudo -u postgres psql
    

    Alter the user role

    alter role <user-name> superuser;
    
    0 讨论(0)
  • 2021-01-17 10:24

    The user which you're performing your pg_dump as doesn't have permissions on the public schema.

    Add permissions if allowed:

    GRANT USAGE ON SCHEMA public TO <user>;
    GRANT SELECT ON ALL TABLES IN SCHEMA public TO <user>;
    
    0 讨论(0)
  • 2021-01-17 10:27

    This can be a common error, when using a ROLE (user) that could not open the objects to dump them.

    Like said before, you can grant to the specific schema that you want to dump, or even use a ROLE with SUPERUSER attribute.

    Note that when you are dealing with some cloud database providers, like AWS/RDS you will not receive a user with the SUPERUSER attribute, so you will need to manage to make sure that the one used to dump will have all access needed.

    https://www.postgresql.org/docs/current/static/sql-grant.html will show how give GRANT to many objects on your database, but also remember that when restoring you will need to create the database first. Only if you are using pg_dumpall that is not necessary, but you also need to dump the ROLES.

    0 讨论(0)
提交回复
热议问题