Interview Prep/SRE & Reliability/Backups, DR & Runbook Automation

A restore test fails with `pg_restore: error: could not execute query: ERROR: role "app_rw" does not exist`.

BeginnerTroubleshootingBackups, DR & Runbook Automation
Answer

Likely causes → pg_dump captures objects and ownership but not cluster-wide roles. The target server lacks the roles referenced by OWNER TO and GRANT statements.

Diagnose → Check roles on the target with \du in psql.

Fix → Restore roles first (pg_dumpall --roles-only from the source, or create them via IaC), or restore with --no-owner --no-privileges and reapply grants.

Prevent → Include roles in the backup set and run automated restore tests into an empty instance, which catch exactly this.

All SRE & Reliability questions Roadmap: Backup & disaster recovery

More on Backups, DR & Runbook Automation