Pawel Veselov <pawel.veselov@gmail.com> writes:
> Was trying to import a database from a cloud deployment, and ran into this.
> Exported the database with:
> * pg_dump (PostgreSQL) 12.20 (Ubuntu 12.20-0ubuntu0.20.04.1)
> * RDS PostgreSQL 12.19 on x86_64-pc-linux-gnu, compiled by gcc (GCC)
> 7.3.1 20180712 (Red Hat 7.3.1-12), 64-bit
> This produced a dump file of version 1.16, at least according to 'file'.
Better take another look at which pg_dump you used. Archive version
1.16 was introduced in PG v17, according to a quick look at the source
code. pg_restore versions older than v17 are not going to understand
it.
> I'm not sure whether the server has any say in the version of the dump
> file, I assume it doesn't.
Nope, just pg_dump.
> So, how come older software (according to versions) produces dump
> files with a greater version
> than the newer software can understand? Is this Ubuntu package
> maintainers messing things up?
You'd have to ask them.
> Given a pg_dump, it would be nice if its "-V" output would say which
> version of the dump it would produce,
> and a pg_restore - what's the max (and min, if that's a thing) version
> of the dump that it will accept.
Hmm, maybe. The original thought was that the archive version would
seldom be a limiting factor: it describes the file format but not the
SQL inside the file, and that's often version-specific too. So in
general we don't promise that pg_dump version N will produce output
that you can use with pg_restore or server versions less than N,
whether they share the same archive version or not.
regards, tom lane