I receive the following error when attempting to restore a postgres database schema from an .sql dump file created on another server:
REVOKE psql:backup.sql:158885: ERROR: role "server_name" does not exist
The dump file was created using pg_dump -U username "server_name" -n schema_name > schema_name.sql
How can I create a dump file without role and/or permissions?
By utilizing the flags --no-owner and --no-acl
Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O, any user name can be used for the initial connection, and this user will own all the created objects.
Prevent restoration of access privileges (grant/revoke commands):
pg_dump --no-owner --no-acl -U username "server_name" -n schema > schema.sql
https://www.postgresql.org/docs/9.2/static/app-pgrestore.html