The full error looks like this:
pg_dump: error: aborting because of server version mismatch
pg_dump: detail: server version: 17.4; pg_dump version: 16.8Why it happens
pg_dump can back up servers older than itself (all the way back to PostgreSQL 9.2) but refuses servers newer than itself. Each major version can add features and catalog changes an older pg_dump doesn't know about, and it would rather stop than produce an incomplete backup. Only the major version matters: pg_dump 17.0 dumps a 17.6 server fine.
It usually shows up when:
- your hosting provider upgraded the database (Supabase, Neon, RDS and others move to new major versions),
- you created a new database on a newer version than your local install, or
- Windows is picking up an old pg_dump first, even though a newer one is installed.
Step 1: See which pg_dump you're running
Get-Command pg_dump.exe -All | Select-Object Source
& pg_dump --versionThe first line lists every pg_dump.exe on your PATH, in the order Windows tries them. The first one wins. It's common to find an old C:\Program Files\PostgreSQL\12\bin ahead of a newer 17\bin, or a copy that came with pgAdmin or another tool.
To see what's installed regardless of PATH:
Get-ChildItem 'C:\Program Files\PostgreSQL\*\bin\pg_dump.exe' | ForEach-Object { '{0} {1}' -f $_.VersionInfo.ProductVersion, $_.FullName }And the server's version, from any SQL client: SELECT version(); or SHOW server_version;.
Step 2: Fix it
Pick whichever fits:
- Call the right pg_dump by full path. In scripts, this is the most robust fix:
& 'C:\Program Files\PostgreSQL\17\bin\pg_dump.exe' -h myhost -U myuser -F c -f backup.dump mydb- Install newer client tools. If you don't have a new enough version, install the latest PostgreSQL's Command Line Tools only. You don't need the server. See how to install the PostgreSQL command-line tools on Windows. Newer tools back up older servers, so the newest release covers everything.
- Fix PATH order. In System Properties → Environment Variables, move the newest
…\PostgreSQL\NN\binabove older ones (or remove old entries). Open a new terminal afterwards.
The backup script in the main Windows guide avoids the problem entirely: it searches Program Files\PostgreSQL and uses the newest pg_dump it finds, whatever PATH says.
The restore side: "unsupported version in file header"
The reverse problem shows up when restoring:
pg_restore: error: unsupported version (1.16) in file headerA custom-format dump made by a newer pg_dump can't be read by an older pg_restore. Use a pg_restore at least as new as the pg_dump that made the file. The server you restore into can be older: pg_restore 18 restores into a PostgreSQL 15 server, as long as the dump doesn't use features that server lacks.
How PostgresBackup avoids this
PostgresBackup ships with the PostgreSQL 18 client tools, and if your PC has a newer PostgreSQL installed, it uses that instead. It always picks the newest pg_dump, pg_restore and psql together from one folder. If a server is ever newer than every pg_dump available, the error explains what to do (usually: install the latest PostgresBackup update) instead of only showing pg_dump's message.