Skip to content

Fix pgAdmin Backup & Restore – Incomplete or Corrupt Dumps

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Fix pgAdmin Backup & Restore. We cover key concepts, practical examples, and best practices.

You use pgAdmin's Backup… dialog on a production database, then try to restore it on staging — only to find missing tables, failed constraints, or a dump file that's suspiciously small.

Wrong ❌

# What pgAdmin generates when you click Backup with defaults
pg_dump --host localhost --port 5432 --username postgres --format custom \
  --file "/tmp/prod.backup" mydb

On restore:

pg_restore --host localhost --port 5432 --username postgres --dbname staging_mydb \
  /tmp/prod.backup

Result:

pg_restore: error: could not execute query: ERROR:  relation "users" does not exist

The dump was taken without --schema or --section, but the real issue: the backup didn't include all objects because pgAdmin's defaults skip e.g. --blobs, --no-owner, or --no-tablespaces.

In pgAdmin Backup dialog:

  1. Right‑click the database → Backup…
  2. Format: Custom
  3. Compression: 9 (maximum)
  4. Encoding: UTF8
  5. Objects: Tick Only data or Only schema as needed, or leave both unticked for full dump
  6. Options tab:
    • ☑ Include CREATE DATABASE statement (for a full restore)
    • ☑ Include blobs in dump
    • ☑ Use Column Inserts (safer cross‑version)
    • Verbose messages (helps debug failures)
  7. Click Backup

Restore with care:

  1. Create empty target database: CREATE DATABASE staging_mydb;
  2. Right‑click it → Restore…
  3. Pick the backup file
  4. Options tab:
    • ☑ Clean before restore
    • ☑ Create objects if they don't exist
    • ☐ Exit on error (uncheck to see all warnings)
  5. Click Restore
pg_restore: processing data for table "users"
pg_restore: processing data for table "orders"
pg_restore: processing data for table "products"
... done

Root Cause

pgAdmin's backup/restore dialogs are wrappers around pg_dump / pg_restore. Defaults vary by pgAdmin version. Missed flags (blobs, ownership, section) cause silent omissions.

Prevention

  • Always tick Verbose messages and review the output tab.
  • Use Plain format for the first backup — it's human‑readable and easier to debug.
  • Restore into a test database first, then run SELECT count(*) on key tables.
  • Schedule backups via cron using explicit pg_dump commands — don't rely on the GUI for automation.

Common Mistakes with backup restore

  1. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
  2. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  3. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks

These mistakes appear frequently in real-world PGADMIN code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

**Q: Why is my restore failing with "role does not exist"?**

A: The dump includes OWNER TO clauses. Create the role first, or use --no-owner during restore.

**Q: Can I backup a single table through pgAdmin?**

A: Yes — right‑click the table → Backup… instead of the database.

**Q: Are pgAdmin backups encrypted?**

A: No — pg_dump output is plain. Encrypt at the filesystem level (e.g. gpg) or use a cloud backup service that encrypts at rest.

**Q: Why is my custom‑format backup so small?**

A: Custom format uses compression by default. If it's too small, check Verbose output for warnings about skipped large objects.


Design a disaster‑recovery strategy with the [DodaTech PostgreSQL Backup & Recovery course](https://dodatech.com/courses/postgresql-backup).

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro