Is pg_dump as acceptable as pg_dumpall for upgrading a database across major PostgreSQL versions?
0
votes
1
answer
46
views
I recently migrated a Postgres database from one server running Ubuntu 20.04 and Postgres 12 to another server running Ubuntu 24.04 and Postgres 16. To move the database from one server to the other, I did the following:
```
# On the Postgres 12 system
$ sudo pg_dump -C sales_database > sales_database_bak.sql
# On the Postgres 16 system
$ sudo -u postgres psql 16 jump I performed, states
> A dump/restore using pg_dumpall or use of pg_upgrade or logical replication is required for those wishing to migrate data from any previous release. See [Section 19.6](https://www.postgresql.org/docs/15/upgrading.html) for general information on migrating to new major releases.
That is, the notes specifically cite pg_dumpall, not pg_dump, as necessary for the upgrade. The linked Section 19.6 continues to cite pg_dumpall without mentioning pg_dump. Of course, the two aren't that different: pg_dumpall calls pg_dump during operation. However, it's possible that pg_dumpall does something else that makes it different from pg_dump alone.
I'm troubleshooting an error on the new system, and I want to make sure this isn't the issue. For the purposes of the upgrade, is pg_dump exactly equivalent to pg_dumpall for transferring a database in compliance with the upgrade requirements cited in the Postgres 15 upgrade notes?
Asked by Borea Deitz
(151 rep)
Jun 3, 2025, 07:41 PM
Last activity: Jun 4, 2025, 04:49 AM
Last activity: Jun 4, 2025, 04:49 AM