Tabellum

pg_dump version mismatch, both ways: what fails, measured on PostgreSQL 14 to 19

A 5x5 pg_dump matrix on PostgreSQL 14-19, plus restores: why a dump from a newer pg_dump fails on transaction_timeout, even into the server it came from.

There are two pg_dump errors people paste into search, and they point in opposite directions.

pg_dump: error: aborting because of server version mismatch
ERROR:  unrecognized configuration parameter "transaction_timeout"

The first means your pg_dump is too old for the server. It's the subject of a Stack Overflow question from 2012 with close to 485,000 views that still gets activity. The second usually means your pg_dump is too new for the server you're restoring into, and it has been turning up a lot lately, as CI runners and fresh Ubuntu installs moved to pg_dump 18. In getodk/central#2315, opened on November 9, 2026, a host pg_dump 18.6 made backups that didn't restore into a 14.23 database, and the issue is titled "restoring ubuntu 26.4 backups to postgres v14 fails".

So we ran every pg_dump from 14 to 19 against every server from 14 to 19, then restored the dumps across versions and recorded what broke. Most of it is the documented rule. One part isn't what people expect: a newer pg_dump's dump of a 16 server won't load back into that same 16 server.

The rule, from the manual

The pg_dump documentation says it in its Notes section. pg_dump "can also dump from PostgreSQL servers older than its own version", but it "cannot dump from PostgreSQL servers newer than its own major version; it will refuse to even try, rather than risk making an invalid dump." And then the sentence that matters for the second error:

it is not guaranteed that pg_dump's output can be loaded into a server of an older major version — not even if the dump was taken from a server of that version.

The test

Official Docker images: PostgreSQL 14.25, 16.16, 17.12, 18.7 and 19.0, the current minor of each major on the day we ran it (19.0 came out on November 19, 2026; 14.25 is the last 14, which reached end of life on November 12). Plus 16.9 for one case further down. Each server gets the same small schema: an orders table with 1000 rows, an identity primary key, an index and a view. Superuser, default settings. Every client major dumps every server major, in plain and custom format, and then the dumps made of the 16 server are restored across majors with psql and pg_restore. We ran it twice and got the same output both times.

The script is measure.sh. It needs only Docker.

One small schema is the scope. A real database with extensions, newer syntax or non-default settings can only add failures to the restore half of this, never remove them.

Dumping: a clean triangle

pg_dump ↓ / server → 14 16 17 18 19
14 ok refused refused refused refused
16 ok ok refused refused refused
17 ok ok ok refused refused
18 ok ok ok ok refused
19 ok ok ok ok ok

"Refused" is exit code 1 and aborting because of server version mismatch, with both versions printed next to it. pg_dump N dumps any server up to N, exactly as documented.

That's the easy direction. The fix is always the same: use a pg_dump at least as new as the server. If you dump several servers, the newest server decides.

Restoring: same server, still fails

Now take that advice literally. You have a 16 server, your machine has pg_dump 18 (or 19), and you dump the 16 server. Line 13 of the plain-format file is:

SET transaction_timeout = 0;

transaction_timeout is a server setting added in PostgreSQL 17. pg_dump 18 and 19 write that line even when the server they're dumping is a 16, and a 16 or 14 server has never heard of it. Here's what happened to that one file, made by pg_dump 18 and by pg_dump 19 (both gave identical results):

loaded into with result
16 (the server it came from) psql -v ON_ERROR_STOP=1 stops at line 13, exit 3, orders never created
16 psql, default settings 1 ERROR, exit 0, all 1000 rows loaded
14 psql -v ON_ERROR_STOP=1 stops at line 13, exit 3
14 psql, default settings 1 ERROR, exit 0, all 1000 rows loaded
14, using psql 19 as the client ON_ERROR_STOP=1 stops at line 13, exit 3
17 or 18 either clean

A newer psql doesn't help. The error comes from the server, not the client.

Custom format (-Fc) is worse, because there's a second check on top:

archive from pg_dump 18 or 19, restored into 16 with result
pg_restore 14 or 16 refuses to read it: unsupported version (1.16) in file header
pg_restore 17, 18 or 19, --exit-on-error stops on SET transaction_timeout = 0;, exit 1
pg_restore 18 or 19, default settings exit 1, errors ignored on restore: 1, all 1000 rows restored

That last line is the one that wastes an afternoon. Everything was restored, and the exit code says it failed. Any script, and any GUI that reads the exit code, reports a failed restore, and people go looking for a problem in their data. pgAdmin issue #8171 is this exact output: a database backed up and restored on the same server, errors ignored on restore: 1, reported as a failed restore. It was closed as not planned, with a maintainer saying "It is not a pgAdmin issue you need to set the default binaries compatible with your PostgreSQL version." Which is correct, and also the reason this keeps happening.

The quieter one: \restrict

The same file has a \restrict <key> line near the top and \unrestrict <key> at the bottom. These are psql meta-commands added in the August 14, 2025 minor releases (17.6, 16.10, 15.14, 14.19 and 13.22) to fix CVE-2025-8714, where a malicious source server could make a plain dump run psql meta-commands on the machine doing the restore. The 16.10 release notes describe it: psql gets "a \restrict command that prevents execution of further meta-commands", and pg_dump issues it "before any data coming from the source server."

A psql from before those releases doesn't know the command. psql 16.9, given the same file with the transaction_timeout line already deleted, stopped at line 5 with invalid command \restrict and exit 3. psql 16.16 and 14.25 accepted it. So if you restore plain dumps with an old psql, "update to the current minor" is a real fix here, not boilerplate.

What to do

Dumping. Use a pg_dump of the same major as the server, or newer. Older ones refuse.

Dumping in order to restore into an older major, or back into the same one. Use the pg_dump that matches the target's major. That's the only route with no editing. If the target is 16, dump with 16, even when the source is 16 and you have 18 installed.

You already have a newer dump and need it in an older server. Delete the one line. On our file that was enough: with the line gone, psql 16 loaded it with ON_ERROR_STOP=1, exit 0, all 1000 rows.

# plain format
sed '/^SET transaction_timeout = 0;$/d' dump.sql | psql -v ON_ERROR_STOP=1 -d target

# custom format: let the newer pg_restore write SQL, then do the same
pg_restore -f - dump.custom | sed '/^SET transaction_timeout = 0;$/d' | psql -v ON_ERROR_STOP=1 -d target

We ran the second form too, with pg_restore 19 and psql 19 against a 16 server, and it loaded cleanly. Keep ON_ERROR_STOP (or --exit-on-error) on. Without it, the one error you expected and some other error you didn't look exactly the same in the output, and a richer schema than ours has more chances for the second kind. Read every error, don't count them.

CI. Pin the client major to the service major. The getodk issue above is this case: the runner's pg_dump was 18.6, the database was 14.23.

What GUI clients do about it

A database GUI that backs up with pg_dump inherits all of this. What changes is how much of the version choice it leaves to you. From their own docs, read on November 23, 2026:

  • DBeaver runs a local client you configure. On macOS and Linux "the client never ships with DBeaver", and the tools work with remote databases "as long as the client version is compatible with the server". It doesn't define "compatible" there, and as the tables above show, it depends on which way the data is going.
  • pgAdmin has a Binary paths setting with a grid per server version, plus a default it falls back to. That works if every row is filled in. The pgAdmin issue above is what the fallback looks like when it isn't.
  • TablePlus "ships with its own dump and restore tools for each supported server version", and its backup and restore page tells you to choose the tool version and "Pick the one that matches your server." It remembers the choice per connection. Of the three, this is the one that solves most of the problem, as long as you pick the target's version when restoring into an older server. (TablePlus now labels these windows "Legacy" next to a newer Sync database feature.)

Where Tabellum sits

Tabellum, the database client this blog belongs to, comes in two desktop builds, and they back up differently.

Per its user guide, the Mac App Store version "backs up through the database connection itself": the schema and rows go into one SQL file of statements and INSERTs, or into CSV, JSON Lines or an Excel workbook. No pg_dump is involved, so neither error in this article comes from that route. The same page is plain about the cost: it's "slower than the database's own backup tools and no substitute for them on a very large database."

The version downloaded from the website is the other case. The guide's reference chapter says that, compared with it, the App Store version "backs up through the connection rather than with tools such as pg_dump". The guide doesn't say which pg_dump version it uses or how it picks one, so we won't either. Everything in the tables above applies to it as it does to any other client, and so does the advice: for a restore into an older major, the target's version decides.