could not execute query: ERROR: role does not exist
This is a common error that usually happens on restoring PostgreSQL database backup to another server.
We can avoid this error by taking the dump file using the following command.
#pg_dump --no-owner --no-acl db > db.sql
Where db need to be replaced with the name of the database that need to be backed up.
This dump file can be restored to any server without any issues.