I backed up a server with
pg_dumpall.exe --file "backup.sql" --host "db" --port "5432" --username "user" --no-password --database "postgres" --verbose --clean
but when I tried to restore it on a new machine, I'm getting
postgres@home-lab-db-15:/home/ubuntu$ psql -f home-lab-db.sql postgres -v ON_ERROR_STOP=1
SET
SET
SET
CREATE ROLE
ALTER ROLE
CREATE ROLE
ALTER ROLE
CREATE ROLE
ALTER ROLE
CREATE ROLE
ALTER ROLE
psql:home-lab-db.sql:24: ERROR: role "postgres" already exists
I tried to drop the cluster and recreate it, but same error. I could not drop the postgres role or database cannot drop role postgres because it is required by the database system
The docs say
if you are loading into an empty cluster then postgres should usually be used
so I'm confused at how to restore the backup.