skip to Main Content

Database role XYZ does not have any privilege.How assign privileges for that particular role to create a backup of database using pg_dump?

Grant SELECT ON ALL TABLES IN Schema public TO :XYZ

Is it possible to restore the backup with appropriate privilages?

2

Answers


  1. Yes GRANT SELECT ON ALL TABLES IN SCHEMA public TO XYZ; will give XYZ the privilege to create a dump of your database using pg_dump, but in order for you to restore the backup (dump) with the appropriate privileges, ensure that you ran the GRANT command before making the dump.

    Login or Signup to reply.
  2. First of all YES, the GRANT SELECT ON ALL TABLES IN SCHEMA public TO XYZ will work fine for creating a dump using pg_dump command.

    But, ensure that the database, role, and dump must be existing before pg_restore is run.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search