Skip to content
Mementropy
Lab NotesHomelab notebookField note

Test-restoring each Postgres dump into a scratch database

The Infisical, Gitea and Kaneo dumps restored with 752, 116 and 45 tables.

By Ryan Hammang

Each service on the management cluster has its own Postgres. I didn’t want to assume the dumps were good, so I restored each one.

The method was the same each time:

  1. pg_dump -Fc from the service’s Postgres pod.
  2. Create a scratch database with a throwaway name in the same Postgres.
  3. pg_restore --no-owner --no-privileges into it.
  4. Count the public tables and compare.
  5. Drop the scratch database.

Results today:

  • Infisical: a 4.3 MiB dump, 752 public tables. That matches the table count from my older Infisical install.
  • Gitea: 358 KiB, 116 tables, and my test repository was present.
  • Kaneo: 121 KiB, 45 tables.

One small catch. I tried SELECT count(*) FROM knex_migrations; on the Infisical restore and got relation "knex_migrations" does not exist. Infisical renames that table to infisical_migrations.

A table count isn’t a full proof. It does catch an empty or truncated dump, and it’s cheap enough to run every time.

What else do you check after a test restore?

Recipes written later from this work: