postgres - pg_dump and pg_restore without roles

The error occurs when pg_restore set the ACLs : you can use --no-acl to prevent GRANT commands.

With the -Ft option in pg_dump, you can skip roles and ACLs only in pg_restore. You can also edit the catalog with --list if you need more details.


Using PostgreSQL 12.4:

$ pg_dump --help
...
-O, --no-owner               skip restoration of object ownership in
                             plain-text format
...
-x, --no-privileges          do not dump privileges (grant/revoke)

Here's an example:

$ pg_dump -O -x mydb_development | gzip > mydb-2020-09-22.bak.gz