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
Yes
GRANT SELECT ON ALL TABLES IN SCHEMA public TO XYZ;
will give XYZ the privilege to create a dump of your database usingpg_dump
, but in order for you to restore the backup (dump) with the appropriate privileges, ensure that you ran theGRANT
command before making the dump.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.