I am doing a pg_restore of a database, which is nothing difficult, but I also am creating a new server first, and rather than painstakingly making sure I create all users and roles etc prior to pg_restore (so we can have the same perms), is there some obvious way of doing this I'm unawares of?
pg_restore is only used for custom/directory format dumps done by pg_dump. Roles are global objects, not per database. So you have to use "pg_dumpall -g" to grab the global objects. That creates a standard sql file that you then use "psql -f" to restore.
And to clarify, while the roles themselves are global, the GRANTS are per database and would be contained in the pg_dump files along with the objects those grants are for.