A backup you have never restored is a hope

Restore-testing a Supabase Postgres backup in about fifteen minutes

Why test the restore

  • A truncated dump, a dump taken with the wrong role and a job that half-failed all look the same in a bucket
  • 72% of 285 German small and mid-sized businesses said they rarely or never test whether their backups restore (Q1 2025 survey)
  • When GitLab went to restore in 2017, none of its five backup and replication methods was working reliably

Step 1: a throwaway Postgres

  • Match your Supabase Postgres major version (select version();)
  • Run it in Docker, bound to 127.0.0.1, with a new random password each time
  • Check readiness over TCP (pg_isready -h 127.0.0.1), not the Unix socket

Step 2: stub what Supabase provides

  • Create the anon, authenticated and service_role roles and the auth.uid() / auth.jwt() helpers
  • Without them, a table with default auth.uid() never gets created, and pg_restore carries on to the end anyway
  • Restore with --no-owner --no-privileges, then sort expected sandbox errors from real ones

Step 3: check what came back

  • Table count matches what you expect
  • Tables that should have rows aren't empty
  • max(created_at) is recent, which catches a backup job that quietly stopped running

Read more

A backup you have never restored is a hope

By Super Lede

A backup you have never restored is a hope

How to restore-test a Supabase Postgres backup by hand: a throwaway Postgres, stand-ins for Supabase roles, and three checks. Full guide: https://backupdrill.com/guides/test-supabase-backup-restore

  • 58